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
66
x-axis tick mark
posted

How can I dynamically generate x_axis tick mark? Currently, all examples are set tick mark of x-axis in JSP. Can we have a whole example for dynamically Chart generation? In the tutorial, I can find part code of that, but it seems the whole code missing. 

Parents
  • 1324
    Verified Answer
    posted

    Hello Ramana,

    Here is the code snippets to add dynamic tick marks to the chart axis.

    ..

    Axis xAxis = new Axis();

    xAxis.setType(AxisType.X.toString());

    xAxis.setAutoRange(true);

    xAxis.setAutoRangeSnap(true);

    xAxis.setAutoTickMarks(false);

               

    String month[] = {"JAN", "FEB","MAR","APR","MAY","JUN","JULY","AUG","SEPT","OCT","NOV","DEC"};

    for(int i=0; i<month.length; ++i) {

         

    TickMark mark= new TickMark();

          mark.setValue(i);

          mark.setTickCaption(month[i]);

          xAxis.getChildren().add(mark);

    }

    xAxis.setAutoGridLines(true);

    chart.getChildren().add(xAxis);

    ..

    Hope it gives you idea to add the tick mark on chart axis.

    Thank you

    Roshan

     

Reply Children