Jump to content
Software FX Community

Repost: How can i zoom a chart?


User (Legacy)

Recommended Posts

I have to Zoom a chart horizontaly, by pressing a button but this code works 

only 1st time...

private double mViewMin=0;

private double mViewMax=0;

private void ZoomX()

{

double ViewMin,ViewMax;

chart.AxisX.GetScrollView(out ViewMin,out ViewMax);

if (mViewMin==0) mViewMin=ViewMin;

if (mViewMax==0) mViewMax=ViewMax;

mViewMin-=0.005;

mViewMax+=0.005;

chart.AxisX.Zoom(mViewMin,mViewMax);

}

As you can see i cache ViewMin and ViewMax, value changes but Graph doesn't.

How can i zoom my charts?, tried adding RecalcScale but nothing changes...

Thanks

--

Corrado Cavalli [Microsoft .NET MVP-MCP]

UGIdotNET - http://www.ugidotnet.org

Weblog: http://www.ugidotnet.org/710.blog

Link to comment
Share on other sites

The problrm with this code is that you are zooming out, not in.

You can not zoom out in a chart that is not zoomed.

Maybe what you want to do is this:

double ViewMin,ViewMax;

chart1.AxisX.GetScrollView(out ViewMin,out ViewMax);

if (mViewMin==0) mViewMin=ViewMin;

if (mViewMax==0) mViewMax=ViewMax;

mViewMin+=0.005;

mViewMax-=0.005;

chart1.AxisX.Zoom(mViewMin,mViewMax);

If not, can please explain what you are trying to do.

--

FP

Software FX

Link to comment
Share on other sites

After your hint i finally got it working, just a note: when zooming and 

scolling i see sometimes X labels disappearing (nothing appear on X Axe),

just scroll a little and labels reappers, is this a bug or is there any

'detail' to set for this behaviour?

Thank you

--

Corrado Cavalli [Microsoft .NET MVP-MCP]

UGIdotNET - http://www.ugidotnet.org

Weblog: http://www.ugidotnet.org/710.blog

Link to comment
Share on other sites

A screenshot won't do because not seeing labels I won't be able to tell 

whether this is wrong or not.

What I need is a repro case, a little bit of code that reproduces the

problem starting with a default chart or a chart file (exported using the

Export method) along with code or instructions to reproduce this case.

The code that you sent before will produce a chart with no labels when the

range being displayed is too small. Too small means that with the number of

decimals used, or the Step being set, the range is empty. For example if you

have a step 0f 0.5 and want to display from 0.1 to 0.2 you will get no

labels.

--

FP

Software FX

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...