c# - How do I bind LineSeries to two different Y axis in WPF? -


my situation such have 6 line-series (i guess default) binding first (left) y axis. have additional 7th line-series needs separately bound second (right) y axis. have following chart:

<charting:chart x:name="charttotal" grid.row="0" verticalalignment="top" minheight="380" style="{staticresource legendfreechartstyle}" titlestyle="{staticresource semiboldtitlestyle}">                     <charting:chart.title>                         <binding path="graphtitle"/>                     </charting:chart.title>                      <charting:chart.axes>                         <charting:linearaxis name="chartprimaryaxis" orientation="y" location="left" showgridlines="true" />                          <charting:linearaxis name="chartsecondaryaxis" orientation="y" location="right" showgridlines="true" />                          <charting:datetimeaxis title="my title" orientation="x"                                                 location="bottom" showgridlines="true" axislabelstyle="{staticresource timeaxislabelstyle}"/>                     </charting:chart.axes>                 </charting:chart> 

so left y axis did code-behind:

lineseries line = new lineseries(); line.independentvaluebinding = new binding("xaxistimestamp"); line.dependentvaluebinding = new binding("dependentvalue"); line.style = this.findresource("mylinestyle") style; line.datapointstyle = this.findresource("mypointstyle") style; line.title = "mytitle"; line.legenditemstyle = application.current.resources["linelegenditem"] style; line.itemssource = points; //basically list of custom class made 

and do:

chart.series.add(line); 

what tried seventh line-series in order bind secondary y axis use ordering number of secondary axis , this:

(chart.axes[1] linearaxis).datacontext = line; 

but did not produce expected result.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -