zoukankan      html  css  js  c++  java
  • WPF Tookit Chart

    如何使用Chart

    实例:

    Binding数据源中是一个KeyValuePair对象。可以是Dictionary.

    <charting:Chart x:Name="chtSummary" Width="770" Height="400" Title="My Chart Title">
        <charting:Chart.TitleStyle>
            <Style TargetType="datavis:Title">
                <Setter Property="FontSize" Value="28" />
                <Setter Property="FontFamily" Value="Arial" />
                <Setter Property="Margin" Value="5, 10, 5, 15" />
            </Style>
        </charting:Chart.TitleStyle>
        <charting:Chart.LegendStyle>
            <Style TargetType="datavis:Legend">
                <Setter Property="Width" Value="0" />
            </Style>
        </charting:Chart.LegendStyle>
        <charting:Chart.Series>
            <charting:BarSeries ItemsSource="{Binding}" DependentValuePath="Value" IndependentValuePath="Key" IsSelectionEnabled="True" >
                <charting:BarSeries.IndependentAxis>
                    <charting:CategoryAxis Orientation="Y" AxisLabelStyle="{StaticResource SummaryChartAxisStyle}" />
                </charting:BarSeries.IndependentAxis>
            </charting:BarSeries>   
        </charting:Chart.Series>    
    </charting:Chart>

    如何添加第二个Y坐标

    secondary y axis on WPF toolkit chart

    实例:

    On the first serie (ColumnSerie on my example), add this

    <DVC:ColumnSeries.DependentRangeAxis >
        <DVC:LinearAxis Location="Left" Orientation="Y" />
    </DVC:ColumnSeries.DependentRangeAxis>

    On the second serie (LineSeries), add this

    <DVC:LineSeries.DependentRangeAxis >
        <DVC:LinearAxis Location="Right" Orientation="Y" />
    </DVC:LineSeries.DependentRangeAxis>

    如何修改图列的名称

    实例:

    LineSeries Title=" Monthly Count" is responsible for display the legend text

    <wpft:Chart Canvas.Top="80" Canvas.Left="10" Name="mcChart"
           Width="400" Height="250"
           Background="LightSteelBlue">
        <wpft:Chart.Series>
         <wpft:LineSeries Title=" Monthly Count"
            IndependentValueBinding="{Binding Path=Key}"
            DependentValueBinding="{Binding Path=Value}">
    </wpft:LineSeries>
    </wpft:Chart.Series>           
    </wpft:Chart>

    改变DataPointStyle

    实例:

    <chartingToolkit:Chart Margin="0,12,12,12" Name="chart1">
       <chartingToolkit:Chart.Series>
        <chartingToolkit:ColumnSeries DependentValuePath="value">
         <chartingToolkit:ColumnSeries.DataPointStyle>
          <Style TargetType="chartingToolkit:ColumnDataPoint">
           <Setter Property="DependentValueStringFormat" Value="{}{0:C0}"/>
          </Style>
         </chartingToolkit:ColumnSeries.DataPointStyle>
        </chartingToolkit:ColumnSeries>
        
       </chartingToolkit:Chart.Series>
       <chartingToolkit:Chart.Axes>
        <chartingToolkit:LinearAxis Orientation="Y" ShowGridLines="False" HorizontalAlignment="Left">
         <chartingToolkit:LinearAxis.AxisLabelStyle>
          <Style TargetType="chartingToolkit:AxisLabel">
           <Setter Property="StringFormat" Value="{}{0:C0}"/>
          </Style>
         </chartingToolkit:LinearAxis.AxisLabelStyle>
        </chartingToolkit:LinearAxis>
       </chartingToolkit:Chart.Axes>
      </chartingToolkit:Chart>
  • 相关阅读:
    C++test 关于resource参数和include/exclude参数说明
    开发程序 ip 127.0.0.0 0.0.0.0原理与区别
    安装rails旧版本出错bin_path': can't find gem railties (["3.0.5"]) with executable rails (Gem::GemNotFoundException)
    rails excel的创建
    ruby nil? empty? blank? 的区别
    rails 调试工具pry 换掉debugger 和 rails c
    rails respond_to 的原理与使用
    rails transaction 的用法
    ssh的传送文件命令
    出现了pid的错误A server is already running. 和如何改变webrick的端口值
  • 原文地址:https://www.cnblogs.com/HQFZ/p/4424249.html
Copyright © 2011-2022 走看看