c# - Charting Toolkit Custom Horizontal Axis values -
i plotting graph of frequency against loudness(decibels) using charting toolkit. horizontal axis frequency has values of 100, 250, 500,1000,2000,4000,6000, , 8000. when plot graph, horizontal axis shows frequency values according 'interval', stays same across x-axis. , x-axis values of different intervals. update: want line graph. here full code xaml is:
<chartingtoolkit:chart name="linechart" title="results"> <chartingtoolkit:lineseries name="mydata" title="calculated data" dependentvaluepath="value" independentvaluepath="key" itemssource="{binding [0]}"/> <chartingtoolkit:chart.axes> <chartingtoolkit:linearaxis orientation="y" minimum="0" maximum="80" title="loudness in db" interval="5" /> <chartingtoolkit:linearaxis name="xaxis" orientation="x" minimum="0" maximum="8000" title="frequency in hz" interval="500" /> </chartingtoolkit:chart.axes> </chartingtoolkit:chart> and c# code is:
private void showlinechart(mychartresult) // mychartresult list of objects // each object has frequency , decibel field { var datasourcelist = new list<list<keyvaluepair<int, int>>>(); (int = 0; < mychartresult.count; i++) datasourcelist.add(new keyvaluepair<int, int> (mychartresult[i].frequency, mychartresult[i].decibels)); linechart.datacontext = datasourcelist; } in graph, decibel values against 100 , 250 plotted horizontal axis doesn't show frequency values of 100 , 250. there way customize (in xaml or c#) x-axis labels can show values mentioned above?
use columnseries:
<chartingtoolkit:chart margin="0" title="chart title"> <chartingtoolkit:chart.datacontext> <local:mydatacollection/> </chartingtoolkit:chart.datacontext> <chartingtoolkit:columnseries dependentvaluepath="decibel" independentvaluepath="frequency" itemssource="{binding}"/> </chartingtoolkit:chart> 
Comments
Post a Comment