Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Controlling the Y-axis values for Chart

    Hi,

    I am using SmartGWT Pro 6.0

    I want to see only the whole numbers in Y-axis values for a Graph (Chart).
    If the value for chart is given as 1, it displays the Y-axis values as 0.5, 1
    If the value is 0, Y-axis values are 0.25, 0.5, 1

    I would like NOT to have the display value in fraction numbers (0.25, 0.5 ...)

    Kindly let me know how to achieve this.

    Thank you.

    Sample source code is:


    SimpleChartData.java

    public class SimpleChartData extends Record {

    public SimpleChartData(String counter, String interval, Integer values) {
    setAttribute("counter", counter);
    setAttribute("interval", interval);
    setAttribute("values", values);
    }

    public static SimpleChartData[] getData() {
    return new SimpleChartData[] {
    new SimpleChartData("Prints", "MFP-1", 0),
    new SimpleChartData("Copy", "MFP-1", 0),
    new SimpleChartData("Fax", "MFP-1", 0),
    new SimpleChartData("Others", "MFP-1", 0),
    };
    }

    }

    SgwtTestApp.java

    public class SgwtTestApp implements EntryPoint {
    public void onModuleLoad() {
    final FacetChart chart = new FacetChart();
    chart.setData(SimpleChartData.getData());
    chart.setFacets(new Facet("counter", "Counter Intervel"), new Facet("interval", ""));
    chart.setValueProperty("values");
    chart.setChartType(ChartType.COLUMN);
    chart.setTitle("Sample Coloum Chart");
    chart.setShowShadows(false);
    chart.setMaxBarThickness(50);
    chart.setHeight(600);
    chart.setWidth100();
    chart.setCanSelectText(true);
    chart.setDataColors("#28C734");
    chart.setLogScale(Boolean.TRUE); // makes the chart use a logarithmic scale
    chart.setUseLogGradations(Boolean.TRUE); // draws gradations based on the logBase
    chart.setLogBase(2);
    chart.setLogGradations(1,2);

    VLayout layout = new VLayout();
    layout.setHeight100();
    layout.setWidth100();
    layout.addMember(chart);
    layout.draw();
    }
    }

    #2
    See FacetChart.gradationGaps.

    Comment

    Working...
    X