(Problems Using Charts) WPF .net 4.5 -
i have been trying set function plot series of data, , chart control gives errors, , annoying, because there no proper tutorials control.
so far have code:
using system.windows.controls.datavisualization.charting; public datatable results; public void plot ( chart chr ) { int cols = results.columns.count; int rows = results.rows.count; ( int j = 1 ; j < cols ; j++ ) { //add serie string name = results.columns[j].columnname; //add data serie list<plotvalue> values = new list<plotvalue>( ); ( int = 0 ; < rows ; i++ ) { datetime? x = results.rows[i][0] datetime?; //time double y = double.parse( results.rows[i][j].tostring( ) ); //value values.add( new plotvalue( x , y ) ); } lineseries serie = new lineseries(); serie.legenditems.add( name ); serie.itemssource = values; chr.series.add( serie ); } }
"results", datatable modified asynchronous process, want read when other process finish.
i've defined class:
public class plotvalue { public datetime? date { get; set; } public double value { get; set; } public plotvalue ( datetime? date , double val ) { date = date; value = val; } }
so far error tells me there no axes (which makes sense) , have no clue on how add them.
please want use no xaml @ design time, c# code @ run time, because number of series might change.
alternatively move other control more straight forward has experience with.
i'm on .net 4.5, , chart control belongs [system.windows.controls.datavisualization.charting]
thanks in advance!!