首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > CAD教程 >

WPF 动态的条形图,(大神们.) 小弟我都快急死了.下午之前必须完成呀

2013-03-26 
WPF 动态的条形图,(大神们...) 我都快急死了.下午之前必须完成呀我初学WPF不到2个星期,今天要完成一个动态

WPF 动态的条形图,(大神们...) 我都快急死了.下午之前必须完成呀
我初学WPF不到2个星期,今天要完成一个动态的条形图.
  脑子就一片空白了,  求指教呀 大神们...
组长帮我下载了一个DevExpress WPF Demos 
  在上面有一个图形的源码是这样的
<Grid>
            <dxc:ChartControl Name="chart" BorderThickness="0" EnableAnimation="True" 
                              CrosshairEnabled="{Binding ElementName=chbVisible, Path=IsChecked, Converter={StaticResource InvertedBoolConverter}}">
                <dxc:ChartControl.CrosshairOptions>
                    <dxc:CrosshairOptions CrosshairLabelMode="ShowForNearestSeries"/>
                </dxc:ChartControl.CrosshairOptions>
                <dxc:ChartControl.Diagram>
                    <dxc:XYDiagram2D BarDistance="0.04">
                        <dxc:XYDiagram2D.DefaultPane>
                            <dxc:Pane MirrorHeight="100.0"/>
                        </dxc:XYDiagram2D.DefaultPane>
                        <dxc:XYDiagram2D.AxisX>
                            <dxc:AxisX2D TickmarksLength="{Binding ElementName=lbModel, Path=SelectedItem, Converter={StaticResource Bar2DKindToTickmarksLengthConverter}}" />
                        </dxc:XYDiagram2D.AxisX>
                        <dxc:XYDiagram2D.AxisY>
                            <dxc:AxisY2D>
                                <dxc:AxisY2D.Title>
                                    <dxc:AxisTitle Content="Millions of Dollars" />
                                </dxc:AxisY2D.Title>
                            </dxc:AxisY2D>


                        </dxc:XYDiagram2D.AxisY>
                        <dxc:XYDiagram2D.Series>
                            <dxc:BarSideBySideSeries2D x:Name="Series1998" 
                                                       DisplayName="1998"
                                                       Model="{Binding ElementName=lbModel, Path=SelectedItem, Converter={StaticResource Bar2DKindToBar2DModelConverter}}"
                                                       AnimationAutoStartMode="SetStartState" >
                                <dxc:BarSideBySideSeries2D.Label>
                                    <dxc:SeriesLabel Indent="20" ResolveOverlappingMode="Default" 
                                    ConnectorThickness="1" 
                                    Visible="{Binding ElementName=chbVisible, Path=IsChecked}"
                                    dxc:BarSideBySideSeries2D.LabelPosition="{Binding ElementName=lbPosition, Path=SelectedItem}" />
                                </dxc:BarSideBySideSeries2D.Label>
                                <dxc:BarSideBySideSeries2D.Points>
                                    <dxc:SeriesPoint Argument="Illinois" Value="423.721" />
                                    <dxc:SeriesPoint Argument="Indiana" Value="178.719" />


                                    <dxc:SeriesPoint Argument="Michigan" Value="308.845" />
                                    <dxc:SeriesPoint Argument="Ohio" Value="348.555" />
                                    <dxc:SeriesPoint Argument="Wisconsin" Value="160.274" />
                                </dxc:BarSideBySideSeries2D.Points>
                            </dxc:BarSideBySideSeries2D>
                            <dxc:BarSideBySideSeries2D x:Name="Series2001" 
                                                       DisplayName="2001"
                                                       Model="{Binding ElementName=lbModel, Path=SelectedItem, Converter={StaticResource Bar2DKindToBar2DModelConverter}}"
                                                       AnimationAutoStartMode="SetStartState"
                                                       ToolTipPointPattern="Year: {S}&#13;&#10;State: {A}&#13;&#10;GSP: {V}">
                                <dxc:BarSideBySideSeries2D.Label>
                                    <dxc:SeriesLabel Indent="20" ResolveOverlappingMode="Default" 
                                    ConnectorThickness="1" 
                                    Visible="{Binding ElementName=chbVisible, Path=IsChecked}"


                                    dxc:BarSideBySideSeries2D.LabelPosition="{Binding ElementName=lbPosition, Path=SelectedItem}" />
                                </dxc:BarSideBySideSeries2D.Label>
                                <dxc:BarSideBySideSeries2D.Points>
                                    <dxc:SeriesPoint Argument="Illinois" Value="476.851" />
                                    <dxc:SeriesPoint Argument="Indiana" Value="195.769" />
                                    <dxc:SeriesPoint Argument="Michigan" Value="335.793" />
                                    <dxc:SeriesPoint Argument="Ohio" Value="374.771" />
                                    <dxc:SeriesPoint Argument="Wisconsin" Value="182.373" />
                                </dxc:BarSideBySideSeries2D.Points>
                            </dxc:BarSideBySideSeries2D>
                            <dxc:BarSideBySideSeries2D x:Name="Series2004" 
                                                       DisplayName="2004"
                                                       Model="{Binding ElementName=lbModel, Path=SelectedItem, Converter={StaticResource Bar2DKindToBar2DModelConverter}}"
                                                       AnimationAutoStartMode="SetStartState"


                                                       ToolTipPointPattern="Year: {S}&#13;&#10;State: {A}&#13;&#10;GSP: {V}">
                                <dxc:BarSideBySideSeries2D.Label>
                                    <dxc:SeriesLabel Indent="20" ResolveOverlappingMode="Default" 
                                    ConnectorThickness="1" 
                                    Visible="{Binding ElementName=chbVisible, Path=IsChecked}"
                                    dxc:BarSideBySideSeries2D.LabelPosition="{Binding ElementName=lbPosition, Path=SelectedItem}" />
                                </dxc:BarSideBySideSeries2D.Label>
                                <dxc:BarSideBySideSeries2D.Points>
                                    <dxc:SeriesPoint Argument="Illinois" Value="528.904" />
                                    <dxc:SeriesPoint Argument="Indiana" Value="227.271" />
                                    <dxc:SeriesPoint Argument="Michigan" Value="372.576" />
                                    <dxc:SeriesPoint Argument="Ohio" Value="418.258" />
                                    <dxc:SeriesPoint Argument="Wisconsin" Value="211.727" />
                                </dxc:BarSideBySideSeries2D.Points>
                            </dxc:BarSideBySideSeries2D>


                        </dxc:XYDiagram2D.Series>
                    </dxc:XYDiagram2D>
                </dxc:ChartControl.Diagram>
                <dxc:ChartControl.Legend>
                    <dxc:Legend ReverseItems="True" />
                </dxc:ChartControl.Legend>
                <dxc:ChartControl.Titles>
                    <dxc:Title Dock="Top" HorizontalAlignment="Center">Great Lakes Gross State Product</dxc:Title>
                    <dxc:Title Dock="Bottom" HorizontalAlignment="Right" FontSize="12" Foreground="Silver" Margin="0,10,0,0">From www.bea.gov</dxc:Title>
                </dxc:ChartControl.Titles>
            </dxc:ChartControl>
        </Grid>
我只能弱弱的看懂一点点...需要显示的数据应该与一个自己写的Model想对应的
然后取值出来显示的, 那该怎么去做呢,model应该如何去写.又是如何将取出来的值放入代码中,如果不是在前台放入值,那么在后台又是怎样放入值呢..  求指教呀
 自己弄了半天,还是不能将数据显示.....
[解决办法]
通过服务去取得数据库中的数据,然后在页面下的CS文件中取得返回的数据
[解决办法]
用图片代替条形图的条状体。

图片的高度就是条形图的值。

位置自己在页面上放好。

热点排行