这是我用来生成它的图表模板XAML代码:
<charting:Chart name="chartUsageHours" GrID.Column="1" borderThickness="0" padding="0" Loaded="chartUsageHours_Loaded"> <charting:Chart.Template> <ControlTemplate targettype="{x:Type charting:Chart}"> <border Background="{TemplateBinding Background}" borderBrush="{TemplateBinding borderBrush}" borderThickness="{TemplateBinding borderThickness}" padding="{TemplateBinding padding}"> <GrID> <GrID.RowDeFinitions> <RowDeFinition Height="auto" /> <RowDeFinition Height="*" /> </GrID.RowDeFinitions> <datavis:Title Content="{TemplateBinding Title}" Style="{TemplateBinding TitleStyle}" /> <chartingprimitives:EdgePanel name="ChartArea" Style="{TemplateBinding ChartAreaStyle}" GrID.Row="1" margin="0,0"> <GrID Panel.ZIndex="-1" Style="{TemplateBinding PlotAreaStyle}" /> <border Panel.ZIndex="10" borderBrush="#FF919191" borderThickness="1,1" /> <GrID name="HoursThresholdContainer" Canvas.ZIndex="1" Background="transparent"> <GrID name="HoursThreshold"> <line name="Horizontal" HorizontalAlignment="Stretch" X1="0" Y1="100" X2="600" Y2="100" stroke="Red" strokeDashArray="4,2"/> </GrID> </GrID> </chartingprimitives:EdgePanel> </GrID> </border> </ControlTemplate> </charting:Chart.Template> <charting:Chart.SerIEs> <charting:StackedColumnSerIEs Visibility="{Binding Include_OnTimeVsFitTime,Converter={StaticResource BooleanToVisibilityConverter}}"> <charting:StackedColumnSerIEs.IndependentAxis> <charting:categoryAxis OrIEntation="X" SortOrder="None" ShowGrIDlines="False"> <charting:categoryAxis.AxisLabelStyle> <Style targettype="charting:AxisLabel"> <Setter Property="Template"> <Setter.Value> <ControlTemplate targettype="charting:AxisLabel"> <TextBlock Text="{Binding Converter={StaticResource DateStringConverter}}" FontSize="8"> <TextBlock.Layouttransform> <Rotatetransform Angle="-90"/> </TextBlock.Layouttransform> </TextBlock> </ControlTemplate> </Setter.Value> </Setter> </Style> </charting:categoryAxis.AxisLabelStyle> </charting:categoryAxis> </charting:StackedColumnSerIEs.IndependentAxis> <charting:SerIEsDeFinition ItemsSource="{Binding ChartUsageHours}" DependentValuePath="Value" IndependentValuePath="Key" /> <charting:SerIEsDeFinition ItemsSource="{Binding ChartOnTimeHours}" DependentValuePath="Value" IndependentValuePath="Key" /> </charting:StackedColumnSerIEs> <charting:StackedColumnSerIEs Visibility="{Binding DontInclude_OnTimeVsFitTime,Converter={StaticResource BooleanToVisibilityConverter}}"> <charting:SerIEsDeFinition ItemsSource="{Binding ChartUsageHours}" DependentValuePath="Value" IndependentValuePath="Key" /> </charting:StackedColumnSerIEs> </charting:Chart.SerIEs> </charting:Chart>
有没有人知道如何做到这一点?
谢谢,
保罗
我在blog post中解释了这个图表的用法.
源代码可以下载到here.
总结以上是内存溢出为你收集整理的wpf – 将水平线添加到Silverlight Toolkit柱形图全部内容,希望文章能够帮你解决wpf – 将水平线添加到Silverlight Toolkit柱形图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)