PDA

View Full Version : How can i add a label for x-axis and y-axis for a chart?



madhu_g
1 Sep 2009, 4:10 AM
Suppose i am giving my X axis labels as jan,feb,mar,apr,may. At the bottom of these labels i want to display a label as "Months". Same thing i need for Y axis also. can any body help me out in getting this ?

madhu_g
1 Sep 2009, 6:14 AM
I have used chartmodel.setXLegend( new Text("Months") );

Now it doesn't even displaying the chart. I guess i am missing out some thing. what is the missing thing here ? or is it a bug ?

Stoot98
1 Sep 2009, 6:16 AM
Try adding..



...
xAxis: new Ext.chart.Axis({
title: 'XXXXX'
}),
yAxis: new Ext.chart.Axis({
title: 'XXXXX'
}),
...


to the chart config

madhu_g
1 Sep 2009, 6:38 AM
I am using EXT GWT . how can i do the same thing in this ?

arkadye
4 Sep 2009, 11:50 AM
I had a similar problem and figured out that axis labels work if you pass the style parameter to the Text constructor, for example:

chartmodel.setXLegend(new Text("Months", "font-size: 12px; font-family: Verdana; text-align: center;"));

borisperezg
10 May 2010, 12:49 PM
Wooaa.... thats correct, thx a lot for the tip....

dhruv88esh
22 Mar 2011, 12:39 AM
Hi friends,
I have set the labels as jan, feb,.... using
XAxis xAxis = new XAxis();
xAxis.setLabels("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
chartModel.setXAxis(xAxis);

Now i want to show them at the Dot in the tooltips, so i'm doing this:-

lineChart.getDotStyle().setTooltip("[Messages: #x_label#, #val#]");

Its showing like this :-
[Messages: , 20]

But its not showing the labels in the tooltips..:(
How can i show these labels in the tooltips..???