on 11-22-2007 7:13 AM
Hi All,
I want to write a javascript for an iChart Applet where i can define the gap after which x-axis label should appear.
For example, if i am plotting a chart of population in a country for all year. I want to show all the bars for 12 months, however, i want to display labels for 1st, 4th, 7th, 10th, 12th bar only. So, that the chart looks neat.
Thanks.
Claude,
By default, the iChart will always display a label for the first and last item, so in your example the 1st and 12th bars should have one, and bar mode will typically show a label for each bar. If you change your XAxisTicksPerLabel setting to 3 shouldn't the remaining items get the labels you desire? If this doesn't work with the standard Bar or GroupBar mode, then switch to Custom mode and make your pen types Bar on the pen details tab and the ticks per label should work. Using the ticks per label will allow the dataset to drive the display items, whereas CustomLabels are just hard-coded custom strings.
Regards,
Jeremy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your inputs Jeremy.
However, I am not been able to do that. XAxisTicksPerLabel is not having any effect on the output.
@Jeremy/Vijaya
Talking about Custum Labels, I guess for that the data will be hard-coded, however, my data is coming from the data source for x-axis labelling.
@Pradeep
The Label Depth is an alternative way for making labels look less clustured but consider the case when we are plotting three values against one x-axis column. In such cases, the same label gets repeated and which is just a shear waste of space.
Please correct me if i have misunderstood your comments.
Hi Claude,
The suggestion given above will work, but for that we have to hard code custom strings.If the objective is just to give a clean representation,then instead of giving alternate lables we can use the depth label feature of the graph.In this the labels will be displayed in a manner which gives a clear and neat picture.
It can be handled from javascript.
var objChart = document.appPopulation.getChartObject(); // appPopulation is the name of the applet
now chart object is assigned to variable objChart. then do
objChart.setXAxisLabelDepth(2); // depth can be set to 2,3,4 ... that defines the depth level
document.appPopulation.refresh();
then clear the java console and refersh the applet.
This will set the depth for the labels.So there will not be any overlapping of labels.
Regards
Pradeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
<b>CustomLabels</b> parameter provides a list of user-provided labels that will be displayed below the X Axis of the chart. The label positions will be evenly spaced based on the number of items provided in the list.
Try using Custom labels with AxisWidth.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
7 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.