This project is read-only.

Independent Y-Axis on ChartPlotter

Jul 13, 2009 at 6:14 PM

Is it possible to have multiple Y-Axes, but have them operate independently of each other?

For example, I would like for a user to be able to click on Y-Axis and pan the values only in the Y-Axis, while all of the other Y-Axis scales remain the same.

Jul 13, 2009 at 7:11 PM
Edited Jul 13, 2009 at 8:16 PM

Hi,

 

Yes, it is possible to have multiple vertical axes - simply create axes and add them one after one to plotter.Children.

Every axis in DynamicDataDisplay takes its values to show from one place - it is plotter.Viewport.Visible. Each axis is capable to transform this value - such DateTime axes are working.

I seem not to understand your second question - what do you mean saying 'while all of the other Y-Axis scales remain the same'? What is 'scale' here?

A picture or set of pictures can help me - you can draw some steps of user interaction with your system.

 

Best refards,

Mikhail.

Jul 13, 2009 at 8:00 PM

Hi. Sorry for the confusion.

By scale, I am referring to the Y-Axis Min and Max. I guess maybe I should refer to it as a range.

Let's say I have a plotter with 2 Y-Axes, each with a range of -100 to 100. I would like for the user to be able to click and drag on Y-Axis #2 and change it's range from -150 to 50, while Y-Axis #1 remains at -100 to 100.

Does this make sense?

 

I am trying to duplicate some behavior that we currently have using another component. Our software is currently written in Delphi,and we are doing some research to port over to WPF.

I can make you a sample application to demonstrate if you can tell me some way to get it to you.

Thanks.

Jul 13, 2009 at 8:19 PM

As, as I've already said, in D3 each axis has a values transform to and from values of viewport. what will it mean in terms of Viewport.Visible (it is a rectangle, and vertical axes are changing its vertical values) if one axis pans while another remains still?

I hope D3 can help you, but I can't get an idea - maybe it is because it is 23:19 in Moscow and it's time to go to bed)))

 

Mikhail.

Jul 13, 2009 at 8:20 PM

Maybe you are speaking not about an axis, but about some value selector?

Jul 13, 2009 at 8:25 PM

We use our plots to overlay related data, however the values sometimes are very far apart.

For example, we may trend a pressure, 8000-9000 psig, and a temperature, 50-150 °F, on the same plot.

 

We like for our users to be able to easily change the visible range of the Y-Axes easily and independent of each other. I think maybe I am not understanding exactly what it is that you are referring to as a viewport.

 

Do you have a site where I may upload a file for you to try?

Jul 13, 2009 at 8:31 PM

You can upload it here - http://box.net/ or here - http://skydrive.live.com/,  both requires registration.

Also, if file or archive is not big, you can mail it to my mailbox - thecentury@gmail.com.

 

Mikhail.

Jul 13, 2009 at 8:50 PM

OK. I will send shortly.

Jul 13, 2009 at 8:57 PM

I have uploaded an example app to http://cid-a317ddba516647ac.skydrive.live.com/self.aspx/.Public/PlotTester.zip

Let me know if you have problems getting it. I tried to email it to your gmail account but it was rejected because of the attachment.

Jul 14, 2009 at 6:51 PM

Hi,

 

Gmail rejected you email because it contained an archive with an executable file. Gmail recognized archive and *exe file by their extension, so you may simply change their extension to e.g. zip_for_gmail, gmail will pass it normally, and you recipient will only have to change the extension.

 

I wanted to notify you that now I'm working on your case, and there are first results, so soon you'll get it!

 

Best regards,

Mikhail.

Jul 15, 2009 at 4:55 AM

Hi,

I think I may have a similar issue. In my case I am plotting measurements of different gases where some are measured in % (0-100 but usually less than 10) and ppm which is often going into the 1000's. I have each axis on a different scale using the DataTransform and the axis ConvertToDouble/ConvertFromDouble, however, scrolling affects all axis (and is throwing an exception as I just found out). 

It would be nice to manipulate each axis independently, which I guess would require a direct association between the axes and the line graphs in the plot so that manipulation of a specific axis affects only the associated LineGraph.  I imagine, though, that that would be a pretty big functionality to implement. If this is what you're working on or there is another solution I would be eager to find out.

BTW, thank you Mikhail for the great work. D3 is by far the best WPF charting component i've come across and the only one that has given good performance to my WPF application.

Best Regards,

Andrew 

Jul 15, 2009 at 4:46 PM

Hi,

 

Take a look on what I've done for you - http://cid-eaf0a921258b5980.skydrive.live.com/self.aspx/.Public/D3/TwoAxesSample.zip

Try to pan different axes and see, what'll happen.

 

Briefly - there are two different plotters, each having its own Viewport and an are to show (Visible in our terms). You can add charts to each of these plotters and they'll be layed out in their plotter's own coordinates.

Note that I'm programmatically making inner plotter have X logical coordinate and width equal to the first plotter values.

You can also disable mouse navigation simply by removing MouseNavigation from outer plotter.

This looks very much like waht michmela44 has posted, so I hope this sample'll help you.

 

Best regards,

Mikhail.

Jul 15, 2009 at 6:02 PM

Hi.

This looks like what i was talking about, but there are a few things that I wanted to point out, that I am not sure if they were intended.

     1. There are three Y-Axes. the one on the right and the one on the far left seem to be tied together. I removed the following two lines from the XAML:

             <d3:VerticalAxis Placement="Right"/>

           <d3:NewAxisNavigation Placement="Right"/>

         I now have only the two Y-Axes on the left, but I don't know if this has any other negative side effects.

    2.  Panning and Zooming over the Grid Viewport does not affect all Y-Axes. This has a strange effect since the x-axis is affected for both

    3.  On the far left Y-Axis, if you move the mouse scroll wheel to zoom, it is then stuck in Pan mode as though you have the left mouse button held down on it.

 

Thanks a lot for your help

 

 

Jul 16, 2009 at 1:19 AM
Hi Mikhail,

thank you for the sample and code.

To test it out I did the following. For each dataset I created an
InjectedPlotter, added a LineGraph to the InjectedPlotter, add a
VerticalAxis to the InjectedPlotter, then added the InjectedPlotter to
the plotters children. Since these are dynamically selected by the user
from items in a listbox I am clearing the plotter of InjectedPlotters
then repopulating it with the new selection.

With this I can click any of the axes on the left and drag it up/down to
move the associated LineGraph, but nothing happens when I try to scroll
(with the wheel). The next thing I tried was to dynamically assign the
MouseNavigation to the appropriate InjectedPlotter by capturing the
MouseDown on the LineGraphs. The idea being a linegraph can be selected
and panned by clicking on it. This works for the first selection, but
afterwards I can't select any others. It seems that the
MouseNavigation.Remove() needs to be called for the LineGraph.MouseDown
to be captured again. Do you have any suggestions here?

If I add the first dataset to the main plot and use the viewport
restrictions then I get the appropriate behavior of having changes
(panning and scrolling) to the x-axis affect all LineGraphs. In this
case, however, i'm also experiencing the stuck panning and scrolling
that Michmela44 described. This only happens when I assign a LineGraph
to the main plotter. Scrolling on the vertical axis works only on the
axis added to the main plotter, but panning (by holding the mouse button
down and moving up/down) works on all axis. One thing I like is that
when the main plotter has the MouseNavigation, zooming by dragging a box
zooms in on all the plots (I guess because of the viewport restriction).

Thanks again for the great work and help. Let me know if you need
clarification on the above.

Best Regards,
Andrew
Apr 8, 2010 at 4:15 PM
Edited Apr 8, 2010 at 7:40 PM

Did anyone ever get anywhere with this?  Seems like multiple y-axes is pretty common in scientific types of applications.  I'm facing the problem where my x-axis only moves the objects in plotter, and not the inner plotter(s).  I'm working in VB and cannot use the lamda expression in the example to sync the x-axis, and wasn't sure how to write it with the callback. Also, like already stated the zooming only effects the objects in plotter, not the inner plotter(s)

Anyone have any suggestions?

Thanks,

Kevin

 

Edit:  Duh.  This seemed to fix my issues for anyone else using VB.


        Dim V As New ViewportRestrictionCallback(AddressOf Callback)

        innerPlotter.Viewport.Restrictions.Add(New InjectionDelegateRestriction(plotter.Viewport, V))


    Public Function Callback(ByVal rect As DataRect) As DataRect
        rect.XMin = plotter.Viewport.Visible.XMin
        rect.Width = plotter.Viewport.Visible.Width
        Return rect
    End Function

Apr 23, 2010 at 1:24 PM

Hi Kevin,

Check

injectedPlotter.SetViewportBinding = false;

If this is not what you want, Then use ViewPort.PropertyChanged event and do somthing like

InjectedPloter.viewPort.Visible = MainPlotter.ViewPort.Visible.

Regards

Ravi.Battula

Apr 23, 2010 at 1:49 PM
Hi,
 
First, I would like to thank the D3 Team and Microsoft for this great free library.
 
I also have a serious need for two independent axes capability in being able to compare two (or more!) plots.
 
The major issue that I have is the lack of any serious code documentation.  I am spending a lot of hours going through the code building an understanding of how D3 works. 
 
I realize that for a Russian team English documentation can be challenging; however, the most important thing needed to turn D3 into an awesome library is really good documentation.
 
If the Russian team does not have the band width to create English documentation, maybe there is someway for the interested users to contribute to a documentation wiki.
 
Anyway, a high level - functional explanation of the D3 library would be extremely helpful from my viewpoint.
 
David Roh
 
 
Jun 9, 2010 at 12:57 PM
Edited Jun 9, 2010 at 1:00 PM
Hi Mikhail & others, just like the original poster I have two (or multiple) dataseries with very different ranges, which I would like to plot in one plotter, on two different Y axes. I browsed through the code (in v0.3) and I understand how the Y-axis gets its range from the viewports data range. I also browsed through the Nightly code and I understand Mikhails solution to work with an InjectedPlotter, which has its own viewport, and hence its own datarange for the second Y-axis. It seems elegant, but as others in this discussion pointed out, zooming behaviour in unintuitive. I would like to propose a different solution, as suggested by showcaser to make a direct association between the axes and the line graphs in the plot so that manipulation of a specific axis affects only the associated LineGraph, and vice versa. I will try to implement this in stable version v0.3 and let you know. Best Regards, elJorro
Jul 27, 2010 at 10:38 PM

Hi Centruy,

You have posted a link  http://cid-eaf0a921258b5980.skydrive.live.com/self.aspx/.Public/D3/TwoAxesSample.zip for a piece of code. Can you post this code again? This link is not working.

I have a requirement to plot two series of measurement data that are measured in Kilo units and milli units. When I add the two series the range is so big that the smaller unit series is almost flat. I need to be able to plot the two series together with independent y-Axis on the left. How can I do this?

thanks

Kishore

Jul 28, 2010 at 8:24 AM
Edited Jul 28, 2010 at 8:29 AM


Hi kvanapal, I downloaded this example some time ago ... I made a link just for you so you can download from that:

http://cid-8804efd5e9189e9a.office.live.com/browse.aspx/TwoAxisSample

bye

Leandro

May 15, 2013 at 8:56 AM
Edited May 15, 2013 at 9:17 AM
Hi All.
I got some little problem with "Independent Y-Axis" in my project.

In sample "TwoHorizontalAxes" (last build DevSamples\TwoHorizontalAxes) you using converter
InjectedPlotterVerticalSyncConverter, and its working good.

In my project I need HorisontalConverter, so I little bit changed yours code for my needs (same converter but for vertical
axes - InjectedPlotterHorizontalSyncConverter).
In project .Net 3.5 work fine, all axes independet scrolling and zooming.
But in .Net 4.0 all vertical axes just freezing (not zooming, not scrolling). It's happen because in .net 3.5
ConvertCore happen only when i change mainplotter visible on horizontal axis.
But in .net 4.0 its happen when I changing mainplotter visible on horizontal axis and on one of vertical axis.
Maybe someone has some advice what can i do in this case?

Upgrade
Link for problem sample
Jun 27, 2013 at 4:58 AM
WarFollowsMe wrote:
Hi All.
I got some little problem with "Independent Y-Axis" in my project.
Hi there,
Has anybody solved this Problem ?

Greetz
hgbutte
Jul 4, 2013 at 2:41 PM
I am interested in this feature too...

I am also not able to download what @TheCentury posted above