Hi,
I would like to show captions that appears along X and Y- axis in a webchart. How do I do that ?
I am adding my axis dynamically to chart as under:
//Add yAxis settings Axis yAxis = new Axis(); yAxis.setAutoRange(true); yAxis.setAutoRangeSnap(true); yAxis.setAutoTickMarks(true); chart1.getChildren().add(yAxis); yAxis.setParent(chart1);
Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4
Hello ,
Here is the code snippet about setting a caption to the axis .
// Create x Axis
Axis xAxis = new Axis();
xAxis.setType(AxisType.X.toString());
xAxis.setAutoRange(true);
xAxis.setAutoGridLines(true);
xAxis.setAutoTickMarks(false);
// Create x Axis caption
TickMark markX = new TickMark();
markX.setValue(0);
markX.setTickCaption("X Caption");
xAxis.getChildren().add(markX);
chart.getChildren().add(xAxis);
// Create y Axis
Axis yAxis = new Axis();
yAxis.setType(AxisType.Y.toString());
// Create Y Axis caption
TickMark markY = new TickMark();
markY.setValue(0);
markY.setTickCaption("Y Caption");
yAxis.getChildren().add(markY);
chart.getChildren().add(yAxis);
Hope this helps.
Sincerely,
Tsvetelina
I am looking for a caption, not a tickmark along the axis !!
I have attached a sample bar chart that shows captions as under:
Here the captions are "Month" for X-Axis and "Number of Students" for Y Axis.
How can I do this with Infragistics webchart. ?
Abhishek
I had tried this before and this is not what I want !!
The statement captionY.setPosition("left") puts caption to the left of
webchart horizontally and this looks BAD. The whole idea of caption for
Y-axis is that it should appear parallel to and along the Y-axis.
Is caption (not tickmark) along Y-Axis supported or not ??
Please check with DEV and inform since this is a very basic requirement for
charts!!
regards.
Hello Abhishek,
I think that you are able to set caption only to the <ig:tickMark> , <ig:series >and <ig:chart >.
I took a look at the example that you sent and I think that you can achieve the desired result with the following actions:
1) Add a caption to the <ig:chart > with LEFT position
Caption captionY = new Caption();
captionY.setCaption("Number of Students");
captionY.setPosition("left");
chart.setCaption(captionY);
2) Add h:outputText at the top of the chart
<div align="center">
<h:outputText style="text-align: center;" value="Birthdays of Students by Month"> </h:outputText>
</div>
3) Add h:outputText at the bottom of the chart
<h:outputText style="text-align: center;" value="Month"> </h:outputText>
Regards,