分享

如何用Chart FX for WPF创建Win/Loss图表

 控件开发 2013-02-28
Win/Loss 图表可以用来记录win/loss/tie记录,现在也越来越多的应用在仪表方面显示值的集合,在本次的文章中,我将演示如何在Chart FX for WPF中创建Win/Loss 图表。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<cfx:Chart.AllSeries>
    <cfx:AllSeriesAttributes>
      <cfx:AllSeriesAttributes.GalleryAttributes>
        <cfxwinloss:WinLoss Goal="30"
                            LossFill="#FF8B89" LossStroke="#FF8B89"
                            WinFill="#909090" WinStroke="#909090"/>
      </cfx:AllSeriesAttributes.GalleryAttributes>
    </cfx:AllSeriesAttributes>
  </cfx:Chart.AllSeries>
  <cfx:Chart.ConditionalAttributes>
    <cfx:ConditionalAttributes Fill="#007010" Stroke="#007010">
      <cfx:ConditionalAttributes.Condition>
        <cfxData:AndCondition>
          <cfx:RangeCondition From="30"/>
          <cfxData:MaximumValueCondition/>
        </cfxData:AndCondition>
      </cfx:ConditionalAttributes.Condition>
    </cfx:ConditionalAttributes>
    <cfx:ConditionalAttributes Fill="Red" Stroke="Red">
      <cfx:ConditionalAttributes.Condition>
        <cfxData:AndCondition>
          <cfx:RangeCondition To="30"/>
          <cfxData:MinimumValueCondition/>
        </cfxData:AndCondition>
      </cfx:ConditionalAttributes.Condition>
    </cfx:ConditionalAttributes>
  </cfx:Chart.ConditionalAttributes>

WPF图表控件Chart FX使用方法系列:如何创建Win/Loss图表

    最后,将会使用WinLoss显示一个新的功能,当图表的尺寸、点数量、或是两者结合产生的条形时,这个功能在条形图中非常的有用,问题是使用 doubles计算尺寸和位置。这将会使得WPF 缩放和的独立的像素像预期的一样工作,但是可能会产生一个问题,在条间的距离不变。比如说,如果现在切换到24点每个产品,设置图表的尺寸为120像素, 就 会出现以下的情况:

WPF图表控件Chart FX使用方法系列:如何创建Win/Loss图表

在PlotArea中有个新的属性叫做PixelSnapMethod现在支持三种值:

None:默认值,对于所有的操作都使用double

Full:确定条的尺寸以及条形之间的距离是固定的,注意这也可能会在图表侧面生成白色区域

Marker:固定条形之间的区域,但是标记可能会有所不同

>Chart FX for WPF下载

1
2
3
4
5
<cfx:Chart.PlotArea>
    <cfx:PlotAreaAttributes Margin="0" AxesStyle="None"
                            Background="{x:Null}" Stroke="{x:Null}"
                            PixelSnapMethod="Full"/>
  </cfx:Chart.PlotArea>

WPF图表控件Chart FX使用方法系列:如何创建Win/Loss图表

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多