c# - how to bind wpf line chart to a datatable? -


here xaml code:

<graphs:chart x:name="chart2" margin="0,236,412,12" horizontalalignment="right" width="417" borderbrush="black" datacontext="{binding}" grid.columnspan="5">             <graphs:lineseries itemssource="{binding}"                 dependentvaluepath="paper"                 independentvaluepath="dates"                 title="paper" isselectionenabled="true" />             <graphs:lineseries itemssource="{binding}"                 dependentvaluepath="plastic"                 independentvaluepath="dates"                 title="plastic" isselectionenabled="true" />             <graphs:lineseries itemssource="{binding}"                 dependentvaluepath="glass"                 independentvaluepath="dates"                 title="glass" isselectionenabled="true" />             <graphs:lineseries itemssource="{binding}"                 dependentvaluepath="metals"                 independentvaluepath="dates"                 title="metals" isselectionenabled="true" />             <graphs:lineseries itemssource="{binding}"                 dependentvaluepath="fabric"                 independentvaluepath="dates"                 title="fabric" isselectionenabled="true" />             <graphs:chart.axes>                 <graphs:linearaxis                                 orientation="y"                                 minimum="0"                                 maximum="1000"                                 showgridlines="true"/>                 <graphs:categoryaxis                                 orientation="x"                                 showgridlines="true"                                 />             </graphs:chart.axes>         </graphs:chart> 

the c# code is:

chart2.datacontext = ad; 

the data table filled sql query, , display fine when bind on grid view, when try bind chart, nothing shows up...


Comments