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

Message ListMessage List     Post MessagePost Message

  Showing non-linear Tick on LineChart-without using setLabel function.
Posted by Yogesh Sherekar on Nov-17-2014 15:30
For XY chart i wanna show exact upper and lower range tick. e.g. lower tick= -0.3 and
upper tick = 7.35. with spacing of 1 between ticks. I tried to use setLinearScale  function,
but it will truncate the upper portion of the curve and doesnt shows the end tick i.e. 7.35.

Also is it possible to show forward arrow in the label of x & y axis?

  Re: Showing non-linear Tick on LineChart-without using setLabel function.
Posted by Peter Kwan on Nov-18-2014 02:46
Hi Yogesh,

Do you mean you want to show something like -0.3, 0.7, 1.7, 2.7, 3.7, 4.7, 5.7, 6.7. It is
starting from -0.3, with a tick every 1 unit. You may achieve this using (in C#/Java):

c.yAxis().setLinearScale(-0.3, 7.35, 1);

With the above code, there would be no tick at 7.35, because the spacing between ticks
is 1 unit. If a tick is at 7.35, then the tick spacing is not 1 unit.

If you want to put the ticks at other positions, you may use Axis.addLabel. For example:

//put a tick at x=7.35 that displays "7.35".
c.yAxis().addLabel(7.35, "7.35");

Note that if you put labels too close together and they overlap, one of the labels may
become hidden. If you want the 7.35 label to always show up, you may use addMark:

c.yAxis().addMark(7.35, -1, "7.35").setMarkColor(Chart.Transparent, 0x000000,
0x000000);

You mentions that setLinearScale will "truncate the upper portion of the curve". Is it
possible that the upper portion of the curve is above y = 7.35? If it is above y = 7.35, it
is normal the curve will fall outside the plot area, as your code specifies the axis scale to
be up to 7.35 only.

If you are referring to x-coordinates, is it possible the x-coordinates of your curve are
beyond 7.35? Note that if you do not provide x-coordinates for your curve (eg. without
using Layer.setXData to specify the x-coordinates), will assume them to be equal to the
array index (0, 1, 2, 3, ....), and it can go beyond 7.35.

Hope this can help.

Regards
Peter Kwan

  Re: Showing non-linear Tick on LineChart-without using setLabel function.
Posted by Yogesh Sherekar on Nov-18-2014 12:21
Attachments:
Hi Peter,

Thank you for reply.

yes i want to show ticks like(-0.3,0,1,2,3,4,5,6,7,7.35) on x-axis
if i use SetLabel function, then ticks will be the labels not the exact value suppose to be on
x-axis for user and in tooltip also labels will not reflect , there the true value of x-axis will
come, if i m correct.

I have attached one pic, please refer.
I have used function c.xAxis().SetLinearScale(-0.3,7.35,1) but on graph it will show tick
upto 6.7 as tick spacing is one.
Is it possible to add one more tick at the end, say 7.35 at the end?
for-forum.png

  Re: Showing non-linear Tick on LineChart-without using setLabel function.
Posted by Peter Kwan on Nov-19-2014 00:10
Hi Yogesh,

If you want the ticks to be at (-0.3,0,1,2,3,4,5,6,7,7.35) , you may use the addLabel
method as mentioned in my previous email. In Java, it is like:

c.xAxis().setLinearScale2(-0.3, 7.35, null);

double[] myTicks = {-0.3, 0, 1, 2, 3, 4, 5, 6, 7, 7.35};
for (int i = 0; i < myTicks.length; ++i)
    c.xAxis().addLabel(myTicks[i], "" + myTicks[i]);

Hope this can help.

Regards
Peter Kwan