1

I have a Dynamic Data Display chart. I am using ChartPlotter. It has a default X and Y Axis. I need to add an extra X axis and two more Y axes. How can I achieve this in XAML and dynamically in code?

The data may be attached to any of these axes by the developers using these charts by providing the enum for the axis number, say, Y1, Y2, Y3 and so on or X1, X2. Currently I would like to have the above limited number of axes.

Could somebody help me out with a solution to this? I know to add Injected Plotter but would I then have to add multiple injected plotters? And if the number of axes does increase, how many more would I have to add? It feels a bit inefficient, hence the question on adding axes to the single ChartPlotter.

1 Answer 1

5

In Dynamic Data Display, each ChartPlotter has a MainHorizontalAxis, and a MainVerticalAxis. On top of that you have the ability to add in new axes. You can create a new Axis object and add it to your plotter very easily. You would add the axis to the plotters children like so :

plotter.Children.Add(axis);

You would set up the axis object beforehand to match the behaviour you desire, and then add the axis to the plot.

EDIT

It looks to me like it's possible to create multiple Graph objects and add them to the plotters children as well. It looks like you are able to assign which axes are applied to which graph object, and then map them accordingly. Information taken from this discussion, and the code posted there.

6
  • 1
    How would I then handle stuff like assigning a line graph to be plotted against one particular axis? I haven't found any solution to that. I already knew about adding the axis object. The problem is telling the linegraph (which is added dynamically through code) that it must set up its data against the second Y axis and the first X axis. How do I handle this issue?
    – Mechanik
    Nov 12, 2012 at 18:39
  • To be fair, I've never actually done this myself, but I will update my answer with some more information. :) Nov 12, 2012 at 18:42
  • Thank you. Have currently used the multiple injected plotters solution. Extremely cumbersome and has a terrible performance cost. :|
    – Mechanik
    Nov 12, 2012 at 18:45
  • Updated! Not a problem. I've never used multiple injected plotters, but I have heard that the performance on it is not the greatest. There are other performance workarounds that I have been using in my projects just to get it into a workable state. Nov 12, 2012 at 18:46
  • the axis parameter that you have there, what exact class is that? All I can find is AxisGrid. Thanks!
    – Rich E
    Jun 16, 2014 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.