Search code examples
c#.netwpfmvvmdynamic-data-display

Dynamic-Data-Display multiple axes scaling


I have a MVVM wpf application with a chartplotter. I have 2 vertical axis and 2 graphs (for example current and voltage over time on one chart).

<d3:ChartPlotter>
        <d3:ChartPlotter.Children>
            <d3:VerticalIntegerAxis/>
            <d3:LineGraph DataSource="{Binding GraphOneDataSource}" Stroke="Blue"/>
            <d3:LineGraph DataSource="{Binding GraphTwoDataSource}" Stroke="Red"/>
        </d3:ChartPlotter.Children>
    </d3:ChartPlotter>

The 2 graphs are scaled differently. I have made one graph scalable with the other by adjusting his mapping like so

GraphTwoDataSource.SetXYMapping(p=>new Point(p.X+1,((p.Y)*(GraphOneMax-GraphOneMin)/(GraphTwoMax-GraphTwoMin))));

The graphs scale with each other. The first graph values are from 1000 to 5000 and the second one's values are 10-50.

I need to adjust the second vertical axis of the chartplotter accordingly. How can you change the behaviour of the axis tick generation so that it scales with the first axis the same way as the graphs scale with each other?


Solution

  • Solved this problem with the DependentPlotter control introduced in the "Future of D3" library