How to start the graph coordinates from 0,0 on x and y axis

Aug 30, 2010 at 12:21 PM

Hi all,

I am using chartplotter control in wpf.  on the graph the  x and y coordinates should start from 0,0 i.e at origin but my graph starts at -ve values.could u please send me a code for this.

 

Aug 30, 2010 at 8:46 PM

Hi,

The easiest way I found is simply to set the Visible property of the ChartPlotter.

So, if your ChartPlotter has a Name attribute of 'plotter'

plotter.Visible = new DataRect(minX, minY, widthX, WidthY);

So to set your axes to start at 0.0, 0.0 with X being 5 units and Y being 10 units long use:

plotter.Visible = new DataRect(0, 0, 5, 10);

This will, of course, be "messed up" is the user pans the axes - to handle that you would be looking at changing/replacing the keyboard and mouse navigation objects

Btw, I had to add

using Microsoft.Research.DynamicDataDisplay.Common;

to get at DataRect but if I remember correctly in the latest (Nightly) build it has migrated to Microsoft.Research.DynamicDataDisplay.

 

Hope this helps

 

Aug 31, 2010 at 2:22 PM

hi

thanks for the code. Now the graph starts from origin.