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

Message ListMessage List     Post MessagePost Message

  on zoomin xlabel will shown multiple of 17 .. till 255
Posted by Poonam bhosale on Apr-10-2023 21:36
i want to apply label on x axis to shown my barchart multiples of 17

  Re: on zoomin xlabel will shown multiple of 17 .. till 255
Posted by Peter Kwan on Apr-11-2023 18:21
Hi Poonam,

In your question, you mentioned "on zoomin". I assume you mean "zoom in" and your chart is zoomable. In this case, the x-axis scale is controlled by the user. For example, the x-axis can be zoomed to 18 to 27. If you need to label to be multiples of 17, it may not have any label at all (there is no multiple of 17 between the axis range 18 to 27).

Anyway, if the axis scale is unpredictable (it is controlled by the user), you can use ask ChartDirector for the axis scale and use Axis.setLinearScale and Axis.addLabel to set the labels with your own code. The exact code depends on the programming language. The following is an example in C#.

// Ask ChartDirector to actual axis scale
double xMin = viewer.getValueAtViewPort("x", viewer.ViewPortLeft);
double xMax = viewer.getValueAtViewPort("x", viewer.ViewPortRight);

// Set the x-axis to use the axis scale (normally syncLinearAxisWithViewPort to
// automatically set the axis scale and the labels, but here we use custom labels).
c.xAxis().setLinearScale(xMin, xMax, Chart.NoValue);

// Put labels at multiples of 17
for (double x = Math.Ceiling(xMin / 17); x <= xMax; x += 17)
    c.xAxis().addLabel(x, "" + x);

If you need further help, please let me know what is your programming language, and whether you are developing a web or desktop application.

Best Regards
Peter Kwan