Proper use of FitToViewRestrictions?

Dec 21, 2009 at 11:54 PM

I have a ChartPlotter where I need to do a couple things:

First, limit the zoom out and pan- I do not want the user to grab the graph and have the option to drag it off the screen, or zoom out beyond what is normally seen for 'Fit to View'.

I also want the data to fix with the X axis locked at the bottom of the graph- if the user tries to grab and drag up or down it should not do anything- but pan and zoom (in) should still work.

In this thread:

http://dynamicdatadisplay.codeplex.com/Thread/View.aspx?ThreadId=78576

Kawone kindly suggested that I use something like FitToViewRestrictions.  I got the example from the nightly build, but I cannot get this to really do anything.

My data starts at about 28,000 and goes to 45,000, on the x axis, and consists of about 72,000 data points (which I hope are being filtered?).  If I use the following code:

 

<c:DynamicPlotter x:Name="spectraPlot" ItemsSource="{Binding Path=LineGraphs}">
	<c:DynamicPlotter.FitToViewRestrictions>
		<d3:MaximalSizeRestriction MaxSize="17000" />
	</c:DynamicPlotter.FitToViewRestrictions>
</c:DynamicPlotter>

DynamicPlotter is derived from ChartPlotter, implementing a dependency property for ItemSource (this was from example code posted by Ravi).  This seems to have no effect whatsoever, other than using the nightly build version of the dll attaches 2 labels to my chart, one upper left, one upper right.  There is no restriction on the viewing area at all.

There are also several other things of interest under FitToViewRestriction, like DataHeightRestriction where I was hoping to autoscale my Y axis data depending on the zoom level.

Am I headed down the right path?  Again, I really need to disable zooming out, moving the x-axis, and enabling some autoscale on the y axis.

Any clues as to what I should do?  Example code or links are very very appreciated!

 

Editor
Dec 26, 2009 at 4:43 PM

Hi! 

Can you please upload somewhere the repro for this case?

Best regards, Mikhail.

Dec 28, 2009 at 4:08 AM

Thanks Mikhail,

Is it possible to email it directly to you or is there somewhere you recommend I post?

Also for the other requests (disable zoom out, enable autoscale on y axis, and fixing x axis location) any thoughts, or is is simpler to show in the project I send?

Thanks!

Jan 3, 2010 at 10:32 PM

Just a little bump here- I guess everyone's still on vacation but I hope to hear a response soon!

Cheers!

Jan 15, 2010 at 8:39 AM
Edited Jan 15, 2010 at 8:43 AM

Hi,

I am not using FitToViewRestrictions, but try the following snippet.

 <controls:DynamicLineChartPlotter ItemsSource="{Binding SeriesData}" Name="plotter">
            <cp:ChartPlotter.Restrictions>
                  <controls:MinSizeRestriction/>
            </cp:ChartPlotter.Restrictions>          
</controls:DynamicLineChartPlotter>


MinSizeRestriction is extended from ViewportRestriction and in Apply() use viewport.UnitedContentBounds to check for intersection and intersect the proposed rectangle.

 Cheers

Naveen

Jul 10, 2013 at 3:20 PM
Hi,


How to restrict the zoom in control from Dynamic Data Display.Other wise How to set the constant Y axis with integer or floating point value?
Jul 11, 2013 at 8:47 AM
Hi

Remove Mouse and keyboardNavigation.
like this
this.plotter.Children.Remove(this.plotter.MouseNavigation);
this.plotter.Children.Remove(this.plotter.KeyboardNavigation);
Regards
Ravi.
Jul 16, 2013 at 8:04 AM
hi Ravi,

Is there is possible to use Y axis always with 10 interval like(100 to 110).or(90 to 100).etc...

For example : My graph is plotting the values in between 100 to 110 means,Y axis range should be 100 to 110.If it exceed more than 110 means It also show that value in Graph.But the interval must be 10.
Jul 16, 2013 at 9:27 AM
Hi,

If you are looking for formatting Y axis label use can use this.
VerticalAxis yAxis = (VerticalAxis)this.plotter.VerticalAxis;
yAxis.LabelProvider.CustomFormatter = this.SetCustomFormat;

private string SetCustomFormat(Microsoft.Research.DynamicDataDisplay.Charts.Axes.LabelTickInfo<double> labelTickinfo)
{
        return labelTickinfo.Tick.ToString("0.00");
}
If you want your own labels and if you want complete control on those labels, like how many number of labels and gap between labels, then derive your own class from NumericYAxis or IAxis.

before doing this check "yAxis.LabelProvider.CustomView = Action delegate";

Regards
Ravi.
Jul 16, 2013 at 1:04 PM
Hi Ravi,

Thanks for your reply,


Image


Actually My question is, In the Y axis (0 to 8000) having 8 values also corresponding 8 Horizontal lines available. I am using autofittoview in my application . In the Zoom in and Zoom out time it showing only 3 or 5 values also corresponding horizontal lines. But I need In all the time it must be show 10 values and also corresponding horizontal lines.

Regards,
Sujith