|
Months not showing as XLabel value? |
Posted by Frank Bailey on Feb-27-2012 19:50 |
|
Hello, I'm experiencing a problem with ChartDirector v5 on a line chart in ASP.
The chart covers a year (Jan to Dec) and the problem is that the image map is only displaying the xLabel on Jan and December. All the other months are blank. So the querystring for the URL on the image map for January is
?type=Leads&dt=Jan&x=63429436800&xLabel=Jan&dataSet=0&dataSetName=Leads&value=3
but for February to November there is no value for xLabel:
?type=Leads&dt=&x=63432060218&xLabel=&dataSet=0&dataSetName=Leads&value=0
This problem is preventing me from passing the correct values to the drill-down chart that goes into a particular month, since the month name is only being passed for Jan and Dec.
I have attached a sample page so you can see exactly what code I'm using.
Please help, this is making me tear my hair out.
Thanks in advance!
Frank
|
Re: Months not showing as XLabel value? |
Posted by Peter Kwan on Feb-28-2012 06:05 |
|
Hi Frank,
There are no xLabel for the data points because the data points do not align with the monthly labels.
What you code is doing is to spread your data points evenly between Jan-1-2011 and Dec-1-2011. However, the months are not evenly spaced (each month has a different number of days). The shortest month has 28 days, while the longest month has 31 days, and there is more than 10% difference, which is quite signifantly. So the data points do not align with the months. In fact, if you look at the chart careful, you can see that the monthly labels are not evenly spaced, and the data points are not exactly at the monthly label positions.
If your intention is to put the data points at the monthly positions (which means the data points are not evenly spaced), but you still want to show as if each month is evenly spaced, you may remove the lines:
Call c.xAxis.setLabelFormat("{value|mmm}")
Call layer1.setXData2(data1Start, data1End)
and add back one line:
Call c.xAxis().setLabels(labels)
This would cause the data points to align exactly with the labels and the xLabel on the image map will have then expected values.
Hope this can help.
Regards
Peter Kwan |
Re: Months not showing as XLabel value? |
Posted by Frank Bailey on Feb-28-2012 18:16 |
|
Thank you very much for your time and attention, Peter - your solution worked perfectly! Your help is immensely appreciated!
Regards
Frank |
|