|
Minor Ticks in Grid |
Posted by Alexander on May-22-2018 00:30 |
|
Hello,
I want to have different colors of vertical grid lines on days and monthes.
How may I set ticks with labels as minor?
Or may I change colors of vertical grid lines for defined ticks?
Or may I draw grid separate from tick labels?
|
Re: Minor Ticks in Grid |
Posted by Peter Kwan on May-22-2018 16:05 |
|
Hi Alexander,
From your screen shot, I assume you are using the FinanceChart object.
In ChartDirector, for label based x-axis, if a label starts with the "-" character, it means the label is a minor tick label. (The "-" character will not be displayed. It is only used to specify that the label is for a minor tick.)
For a FinanceChart, the x-axis labels are automatically generated based on the timestamps. The date/time format is configurable using FinanceChart.setDateLabelFormat. See:
http://www.advsofteng.com/doc/cdnet.htm#FinanceChart.setDateLabelFormat.htm
You can change the format to include a "-" character in the format string, and it will become a minor tick. For the label in your screen shot, it is the "otherDayFormat" format, so the code is like (in C#/Java):
myFinanceChart.setDateLabelFormat(null, null, null, null, "-{value|d}", null, null);
You can set the minor and major tick grid line colors using FinanceChart.setPlotAreaStyle. See:
http://www.advsofteng.com/doc/cdnet.htm#FinanceChart.setPlotAreaStyle.htm
For example:
myFinanceChart.setPlotAreaStyle(Chart.Transparent, 0xaaaaaa, 0xaaaaaa, cd.Transparent, &Heeeeee);
Note that the FinanceChart.setDateLabelFormat should be called before your set the data to the FinanceChart. For example, you may call this method immediately after creating the FinanceChart object.
Regards
Peter Kwan |
Re: Minor Ticks in Grid |
Posted by Alexander on May-23-2018 00:33 |
|
Thank you, Peter. |
|