ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  setting Yaxis range
Posted by Ramesh on May-11-2009 19:24
Hi Peter,
    This is ramesh again. I've another question. I've a control chart with yaxis showing the range of the data. I've to allow the user to configure the y axis.
I did something like this

TopOfChart = YAxisRange(1)
BottomOfChart = YAxisRange(0)


LimitGraph.yAxis.setLinearScale(BottomOfChart, TopOfChart, (TopOfChart - BottomOfChart) / 6)

But the points are getting plotted out side the plot area.

One thing is i'm calculating plot width and plot height automatically based on the yaxis and xaxis labels.
code is as follows:

plotWidth = CInt(GRAPH_WIDTH - leftBorder - rightBorder)
            plotHeight = CInt(GRAPH_HEIGHT - topBorder - bottomBorder)


            Dim LimitGraph As New XYChart(GRAPH_WIDTH, GRAPH_HEIGHT, ChartDirector.Chart.CColor(Color.LightYellow))
            LimitGraph.setPlotArea(leftBorder, topBorder, plotWidth, plotHeight, ChartDirector.Chart.CColor(Color.White))


Please help me.

  Re: setting Yaxis range
Posted by Peter Kwan on May-11-2009 20:13
Hi Ramesh,

If your data are from 0 - 100, but you set the y-axis scale as 30 - 50, then some of the data will be outside the y-axis scale, and so is outside the plot area. This is normal because your data range is larger than the axis scale. This issue is not related to the chart pixel size.

You can ask ChartDirector to clip the chart to the plot area. Some of your data will still be outside the plot area, but they will not be visible. The code is:

c.setClipping()

Hope this can help.

Regards
Peter Kwan

  Re: setting Yaxis range
Posted by Ramesh on May-11-2009 20:24
Hi Peter,

        setClipping requires an integer parameter, is that top of the y axis ?
        where do we need to call setClipping.
       I've tried calling like this.

LimitGraph.yAxis.setLinearScale(BottomOfChart, TopOfChart, (TopOfChart -  BottomOfChart) / 6)

LimitGraph.setClipping(topBorder)

still its not working :(

Ramesh

  Re: setting Yaxis range
Posted by Peter Kwan on May-11-2009 21:18
Hi Ramesh,

The parameter for setClipping is "optional". That means setClipping does not require an integer parameter, but you can provide one if you like.

In your case, you do not need to provide any parameter. If you want to provide a parameter, please use 0.

LimitGraph.setClipping()

or

LimitGraph.setClipping(0)

Hope this can help.

Regards
Peter Kwan

  Re: setting Yaxis range
Posted by Ramesh on May-11-2009 21:21
Sorry Peter,
     It worked for me. I need to call that with zero as parameter.

  YOU ARE MY HERO. Excellent JOB!!!! I liked it

   while typing this reply i got your reply mentioning the same. You are great!!!

Can you please also look into my another question that is a another thread.
Thanks A ton!!!

Ramesh