Vertical axis problems

Apr 27, 2009 at 5:21 PM

Hi,

  1. What’s the purpose of Vertical Axis class?
  2. How to add different axis limits for each vertical axis. (Like 0-100 for YAxis1 and -50 to 150 for Yaxis2)

            I added two Y axes (Vertical axes). I need different limits for these two Vertical axis. I tried to add limits using Plotter ViewPort, But all vertical axes are taking same limit, If I move the plot both y axis limits are changing. Is it possible to configure different Y axis limits for both axes?

my requirement

  1. I added two lines, one line Vertical axis range is (0,100), other axis range is (-100,0),  Based on selection of the data source (line) vertical axis limits should change. (I need to show which data source is selected, Based on that I have to show the limits of Y axis (vertical axis), these selections I will do using radio button or some other thing). But it should not affect the plot (I mean there should not be any changes in the plotting area). I need to change the limits of individual lines separately, If I change the limit of one line there should be any effect on the view of the other line.
    1. Is it possible to do with this control?

Regards
Ravi

 

Apr 27, 2009 at 7:19 PM
Hi,

I am adding one more question for this post, Is it possible to show empty line (no line ), in between a curve.
Here I am adding some code, Here If  " i is greater than 100 and less than 150, I should no show any line.
How to do that, what to add in this place


List
<double> yax1 = new List<double>();

List<DateTime> xAx = new List<DateTime>();

for (int i = 0; i < 360; i++)

{

    if (i > 100 && i < 150)

    {

       yax1.Add(double.Epsilon);

    }

    else if (i > 200 && i < 250)

    {

       yax1.Add(double.Epsilon);

    }

    else

    {

       yax1.Add(i);

    }

 

    xAx.Add(DateTime.Now.AddSeconds(-360 + i));

 }

Regards
Ravi

Editor
Apr 28, 2009 at 9:50 AM
Edited Apr 28, 2009 at 9:52 AM
Hi, Ravi,

1) The purpose of VerticalAxis class is to display a vertical axis with values of double type :)
2) Do you need something like this:


If so, you should execute the following code:


            VerticalAxis axis = new VerticalAxis();

            axis.ConvertFromDouble = d => d - 100;

            axis.ConvertToDouble = d => d + 100;

 

            plotter.Children.Add(axis);

            // this is only an example of visible rectange. Use here rect you actually need.

            plotter.Viewport.Visible = new Rect(0, 0, 1, 100);

About your second post - currently D3 doesn't allow to draw breaking lines. This feature will be added a little bit later.

Regards,

Mikhail.

Apr 28, 2009 at 3:25 PM
Hi,

Thanks for reply.
What I need is some thing like this and that Y axis should be independent from plotter viewport ( or may be convertable based on some convertion).
Can you please explain what axis.ConvertFromDouble and axis.ConvertToDouble are doing?
Whats the relation between axis.ConvertFromDouble and axis.ConvertToDouble and view port
Based on the sample givent by you I tried different conversions, But I didn't find the proper convertion for custom limits (I will get Y axxis limits at run time, based on various events).

 

this.axisY = new VerticalAxis();

 

 

this.axisY.ConvertFromDouble = d => d -100;

 

 

this.axisY.ConvertToDouble = d => (d + 100);

 

 

this.plotter.VerticalAxis = this.axisY;

 

 

this.axisY.IsDefaultAxis = true;

 

 

 

this.plotter.Viewport.Visible = new Rect(0, 0, 1, 100);
Above code is woking I am getting  y axis limits from -100 to 0

 

this.axisY.ConvertFromDouble = d => d -100;

 

 

this.axisY.ConvertToDouble = d => (d + 100);

 

 

 

this.plotter.Viewport.Visible = new Rect(0, 0, 1, 200);
Above code is woking I am getting  y axis limits from -100 to 100 , Because difference is 200

this
.axisY.ConvertFromDouble = d => d -100;

 

 

this.axisY.ConvertToDouble = d => (d + 100);

 

 

 

this.plotter.Viewport.Visible = new Rect(0, 0, 1, 300);
Above code is woking I am getting  y axis limits from -100 to 200 , Because difference is 300

this.axisY.ConvertFromDouble = d => d;

 

 

this.axisY.ConvertToDouble = d => (d *2);

 

 

 

this.plotter.Viewport.Visible = new Rect(0, 0, 1, 100);
Above code is woking I am getting  y axis limits from 0 to 50 ,  I think here it converted based on the factor 2

 

this.axisY.ConvertFromDouble = d => d;

 

 

this.axisY.ConvertToDouble = d => (d *3);

 

 

 

this.plotter.Viewport.Visible = new Rect(0, 0, 1, 100);
Above code is woking I am getting  y axis limits from 0 to 33.33 ,  This also working pretty well.


Now what I need is if I need to show Y axis limits as ( Ymin to Ymax), What convertion I have to use. Can you please expalin.


Regards
Ravi.

 

 

Apr 28, 2009 at 3:48 PM
Hi,

I tried with some convertion algorith (Linear conversion). It works fine for the positive values.

If yMin is -ve then vertical axis is showingblannk space at -ve numbers position. Do I need to do any thing to get the proper y axis.

Here I am pasting the I have tried. Please verify this and suggest some solution.

double yMin = -9.5;

double yMax = 22;

VerticalAxis axisY = new VerticalAxis();

axisY.ConvertFromDouble = d => d;

axisY.ConvertToDouble = d => (((d - yMin) * 100) / (yMax - yMin));

this.plotter.VerticalAxis = axisY;

axisY.IsDefaultAxis = true;

Regards
Ravi

Editor
Apr 29, 2009 at 1:56 PM
Hi, Ravi,

You should change both ConvertFromDouble and ConvertFromDouble, as first is used to create typed range to display for internal AxisControl, and second is used by internal AxisControl to convert tick to double to get tick's coordinates inside of viewport.

I've uploaded here http://cid-eaf0a921258b5980.skydrive.live.com/self.aspx/.Public/D3/DynamicDataDisplay%20v0.3.1/DynamicDataDisplay.zip a development version of D3, in which NumericAxis (and some other axes) has a special method SetConvserion, which takes four parameters - the 1st and 3rd are limits of coordinates (e.g., for vertical case they can be minimal and maximal viewport visible values), and 2nd and 4th are values of axis tick, that you waте to correspond to these minimal and maximal viewport values. In your case these parameters can be, for example (if I've understood you right) 0, -100, 100, 0, as you want second vertical axis display -100 while normal axis displays 0, and display 0 while normal axis displays 100.\

Mikhail.
Editor
Apr 29, 2009 at 1:58 PM
By the way, you can take a part in our survey about the way in which you are using DynamicDataDisplay - this poll is here http://microsoft.cs.msu.su/Projects/Pages/D3Poll.aspx

Mikhail.
Apr 29, 2009 at 4:36 PM

Hi,

I took the latest "DynamicDataDisplay.dll", But its not working, also the major problem is This doesn't have HorizontalAxis It doesn’t have properties like

VerticalAxis axisY = new VerticalAxis();

this.plotter.VerticalAxis = axisY;

 

As I explained to you,

 

double yMin = -20;

double yMax = 50;

VerticalAxis axisY = new VerticalAxis();

axisY.ConvertFromDouble = d => d;

axisY.ConvertToDouble = d => (((d - yMin) * 100) / (yMax - yMin));

this.plotter.VerticalAxis = axisY;

axisY.IsDefaultAxis = true;

this.plotter.Viewport.Visible = new Rect(0, 0, 1, 100);

This part of code is working, The problem what I have with this is not showing tickmarks and vertical axis labels when vertical axis range is from –ve value to +ve value

 if axisY.ConvertFromDouble = d => d; , Then chart is showing only +ve vertical axis tickmarks and lables.
If axisY.ConvertFromDouble = d => - d;,  Then chart is showing only -ve vertical axis tickmarks and lables.

 

Please verify only this part of code , Then you can this is bug or not

public Window1()

{

            InitializeComponent();

            y = new List<double>();

            date = new List<DateTime>();

 

            VerticalAxis axisY = new VerticalAxis();

            double yMin = -20;

            double yMax = 50;

            if (yMin < 0)

            {

                axisY.ConvertFromDouble = d => d;

            }

            else

            {

                axisY.ConvertFromDouble = d => d;

            }

      axisY.ConvertToDouble = d => (((d - yMin) * 100) / (yMax - yMin));

 

      this.plotter.VerticalAxis = axisY;

      axisY.IsDefaultAxis = true;

 

      this.plotter.Viewport.Visible = new Rect(0, 0, 1, 100);

}

 

XAML

<
c:ChartPlotter Name="plotter" Width="Auto" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Row="0">

            <c:ChartPlotter.HorizontalAxis>

                <c:HorizontalDateTimeAxis Name="dateAxis"/>

            </c:ChartPlotter.HorizontalAxis>

              

 </c:ChartPlotter>

Please verify the above code...

Note: The new component is not compiling for me. It seems it is missing some of the methods( like this.plotter.VerticalAxis = axisY;,<c:ChartPlotter.HorizontalAxis> etc).

 

Regards,

Ravi.

Editor
Apr 30, 2009 at 11:42 AM
Hi Ravi,

In that DynamicDataDisplay's version I've posted recently ChartPlotter.HorizontalAxis property was renamed to MainHorizontalAxis, and VerticalAxis was renamed to MainVerticalAxis.

Best regards,
Mikhail.
Apr 30, 2009 at 3:37 PM
Hi,

Thank you, This is working,

When will you release this. What are the new features in this.

Regards
Ravi.
Apr 30, 2009 at 3:39 PM
Have a look to the main page of this project!!!
May 20, 2009 at 8:54 AM

Hi,

I took latest veersion of DDD from main page, http://dynamicdatadisplay.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=26761.

 

 

<font size="2">

MainVerticalAxis axisY =

</font>

new MainVerticalAxis();<font size="2">

 

</font>

 

axisY.SetConversion(0, yMin, 100, yMax);

SetConversion, MainVerticalAxis and MainHorizontalAxis are not available in this version, Can you please update the code,

I need to compile and sign it locally.

Regards

Ravi.

May 20, 2009 at 10:45 AM

Hi,

I took latest code from http://cid-eaf0a921258b5980.skydrive.live.com/self.aspx/.Public/D3/DynamicDataDisplay%20AxisColoringSample.zip this path,

This is working.

Regards

Ravi.