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.

Jason Higgins
  • 1,516
  • 1
  • 17
  • 37
Harsha
  • 661
  • 1
  • 8
  • 21

1 Answers1

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.

Jason Higgins
  • 1,516
  • 1
  • 17
  • 37
  • 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? – Harsha Nov 12 '12 at 18:39
  • To be fair, I've never actually done this myself, but I will update my answer with some more information. :) – Jason Higgins Nov 12 '12 at 18:42
  • Thank you. Have currently used the multiple injected plotters solution. Extremely cumbersome and has a terrible performance cost. :| – Harsha Nov 12 '12 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. – Jason Higgins Nov 12 '12 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 '14 at 18:18
  • It's been a very long time since I've worked with D3 now, so I can't guarantee the correctness of my comment, but if I can recall correctly you can add any axis that is a child of `DynamicDataDisplay.Charts.Axes.AxisBase`. There are several kinds of axes including integer based and time based. In my answer `axis` is just a placeholder for any object that is a child of an `AxisBase`. – Jason Higgins Jun 16 '14 at 18:48