Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
395
How to show captions along X and Y-axis in Chart ?
posted

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);

Parents
  • 19693
    posted

    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());

                                                    xAxis.setAutoRange(true);

                                                    xAxis.setAutoGridLines(true);

                                                    xAxis.setAutoTickMarks(false);

                                                   

                                                    // 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

     

  • 395
    posted in reply to [Infragistics] Tsvetelina Georgieva

    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

Reply Children