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

Message ListMessage List     Post MessagePost Message

  How to represent Y Axis in a custom way ?
Posted by Daniel on Dec-02-2016 00:56
Attachments:
Hi Peter,
I have a line chart where I use the setLabelStep method which is set on 2. On the x axis I represent the weeks and I have noticed that when I have a pair number of weeks the right side of Y axis disappear because of the setLabelStep effect...How could I correct this in other similar cases ?
I would like to find a solution for two common situations:

1. The latest Y right axis to be a straight (continue) line (similar with Y left axis);
2. The latest Y right axis to be a dash line, similar with other vertical lines on Y axis designed for particular values.

I don't think it is necessary to write here any piece of code because I have no doubt you understand very well my issue, just keep in mind that I use VB classic. Thank you in advance.

Regards,
Daniel
cd3.png

  Re: How to represent Y Axis in a custom way ?
Posted by Peter Kwan on Dec-02-2016 02:58
Hi Daniel,

There are many methods:

(a) You can enable the right y-axis by adding something to that axis. Then you can configure the color of the right y-axis. For example:

Call c.yAxis2().setTitle(" ")
Call c.yAxis2().setColors(&Hcccccc)

You can use dash line color as the color of the right y-axis if you want it to be a dash line.

(b) In your code, in the XYChart.setPlotArea line, it probably has set the plot area border color to cd.Transparent. You can set the plot area border color to the same as your grid line instead.

Hope this can help.

Regards
Peter kwan

  Re: How to represent Y Axis in a custom way ?
Posted by Daniel on Dec-02-2016 06:29
Hi Peter,
Thank you for your quick reply. Indeed, the edgeColor argument was set to cd.transparent within setPlotArea method. I changed it as in the grid format and I got a dash line as well. However, I preferred to add the yAxis2 because the chart seems to have a proper border at the end. But interesting, setColors method does recognize the native vbBlack as parameter while setTitle makes a difference between " " and vbNullString. Actually, it doesn't accept a string with length zero which is a bit unusual to me. Apart of it, why should I add a false title " " when c.yAxis2().setColors(vbBlack) had to do the trick by itself ? Just my opinion. Thank you

  Re: How to represent Y Axis in a custom way ?
Posted by Peter Kwan on Dec-02-2016 12:41
Hi Daniel,

By default, the color of the right y-axis is black, just like the left y-axis. There is also a top x-axis that is also black.

However, the right y-axis and top x-axis are only drawn if they are used. That's why your code do not display the top x-axis (in your chart, the top border is the grey grid line color, not the black axis color). For the same reason, the right y-axis is not displayed.

ChartDirector would consider the axis to be not used if there is no scale/label along the axis and the title is empty. Setting a non-empty title causes the right y-axis to be drawn. There are also other methods, such as setting a dummy scale to the right y-axis using setLinearScale, then set the color of the axis labels to cd.Transparent, but setting the axis title is the easiest way.

Regards
Peter Kwan