Hi,

I'm trying to display a line curve using GXT chart. It's a very nice component but I cannot get the X-axis to adjust its range correctly. My data X-values have a range of 65 to 185 but the axis is always displaying a range of 0 to 200. It's calculating a range somehow (how would it guess the 200 otherwise?) but this is not what I want. I tried explicitly setting the X-axis range using setMinimum(65) and setAdjustMinimumToMajorUnit(true) but without effect. Strangely enough, the Y-axis IS automatically adjusted (click here to see a screenshot).

Has anyone seen a similar problem? I tried GXT 3.0.0 and 3.0.1 both without the correct result. See below for a stand-alone code example which should reproduce the problem. Just copy-paste it into a GWT entry point class.

Thanks,

Ralph
-----------------------------
Code:
package com.arcus.childgrowth.client.app;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;

import com.google.gwt.user.client.ui.RootPanel;
import com.sencha.gxt.chart.client.chart.Chart;
import com.sencha.gxt.chart.client.chart.axis.NumericAxis;
import com.sencha.gxt.chart.client.chart.series.LineSeries;
import com.sencha.gxt.chart.client.draw.RGB;
import com.sencha.gxt.core.client.ValueProvider;
import com.sencha.gxt.data.shared.ListStore;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.widget.core.client.ContentPanel;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class App implements EntryPoint
{
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  @Override
  public void onModuleLoad()
  {
    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand()
    {
      @Override
      public void execute()
      {
        onModuleLoadDeferred();
      }
    });
  }

  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  private void onModuleLoadDeferred()
  {
        Chart<NormalValue> chart = getChart();
        ContentPanel panel = new ContentPanel();
        panel.setPixelSize(500, 400);
        panel.setWidget(chart);
        RootPanel.get().add(panel);

        chart.redrawChart();
  }

  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    private Chart getChart()
    {
        long id = 0L;
        List<NormalValue> normalValues = new ArrayList<NormalValue>();
        normalValues.add(new NormalValue(id++, 65.0,  1.12, 1.23, 40.50, 41.44, 42.40, 43.46, 44.54, 45.52, 46.48));
        normalValues.add(new NormalValue(id++, 70.0,  1.16, 1.25, 43.04, 43.73, 44.43, 45.21, 46.06, 46.82, 47.57));
        normalValues.add(new NormalValue(id++, 75.0,  1.22, 1.28, 44.66, 45.59, 46.54, 47.58, 48.64, 49.60, 50.54));
        normalValues.add(new NormalValue(id++, 80.0,  1.26, 1.30, 48.30, 48.50, 48.71, 50.60, 50.76, 51.70, 53.30));
        normalValues.add(new NormalValue(id++, 85.0,  1.31, 1.33, 49.70, 50.03, 50.94, 51.94, 52.93, 53.83, 54.72));
        normalValues.add(new NormalValue(id++, 90.0,  1.36, 1.35, 51.49, 52.35, 53.24, 54.21, 55.15, 56.01, 56.85));
        normalValues.add(new NormalValue(id++, 95.0,  1.41, 1.38, 53.91, 54.75, 55.60, 56.63, 57.42, 58.22, 59.01));
        normalValues.add(new NormalValue(id++, 100.0, 1.41, 1.24, 56.29, 57.10, 57.93, 58.83, 59.67, 60.42, 61.17));
        normalValues.add(new NormalValue(id++, 105.0, 1.34, 1.21, 58.49, 59.30, 60.12, 61.01, 61.82, 62.56, 63.28));
        normalValues.add(new NormalValue(id++, 110.0, 1.36, 1.21, 60.51, 61.33, 62.16, 63.08, 63.89, 64.63, 65.36));
        normalValues.add(new NormalValue(id++, 115.0, 1.42, 1.26, 62.35, 63.20, 64.07, 65.02, 65.86, 66.63, 67.39));
        normalValues.add(new NormalValue(id++, 120.0, 1.51, 1.34, 64.00, 64.91, 65.83, 66.85, 67.75, 68.57, 69.37));
        normalValues.add(new NormalValue(id++, 125.0, 1.64, 1.47, 65.48, 66.46, 67.46, 68.56, 69.54, 70.44, 71.32));
        normalValues.add(new NormalValue(id++, 130.0, 1.77, 1.61, 66.94, 68.01, 69.09, 70.27, 71.35, 72.33, 73.29));
        normalValues.add(new NormalValue(id++, 135.0, 1.88, 1.73, 68.57, 69.70, 70.85, 72.11, 73.27, 74.32, 75.36));
        normalValues.add(new NormalValue(id++, 140.0, 1.98, 1.83, 70.36, 71.54, 72.75, 74.07, 75.30, 76.42, 77.52));
        normalValues.add(new NormalValue(id++, 145.0, 2.05, 1.92, 72.31, 73.54, 74.79, 76.16, 77.45, 78.63, 79.78));
        normalValues.add(new NormalValue(id++, 150.0, 2.10, 2.00, 74.43, 75.69, 76.97, 78.38, 79.72, 80.93, 82.13));
        normalValues.add(new NormalValue(id++, 155.0, 2.14, 2.05, 76.70, 77.99, 79.29, 80.72, 82.09, 83.35, 84.58));
        normalValues.add(new NormalValue(id++, 160.0, 2.16, 2.09, 79.03, 80.33, 81.64, 83.09, 84.49, 85.77, 87.03));
        normalValues.add(new NormalValue(id++, 165.0, 2.18, 2.13, 81.30, 82.61, 83.93, 85.39, 86.82, 88.12, 90.40));
        normalValues.add(new NormalValue(id++, 170.0, 2.19, 2.16, 83.51, 84.83, 86.16, 87.63, 89.08, 90.39, 91.69));
        normalValues.add(new NormalValue(id++, 175.0, 2.20, 2.18, 85.66, 86.98, 88.32, 89.80, 91.26, 92.59, 93.89));
        normalValues.add(new NormalValue(id++, 180.0, 2.21, 2.19, 87.75, 89.08, 90.42, 91.90, 93.37, 94.70, 96.02));
        normalValues.add(new NormalValue(id++, 185.0, 2.21, 2.20, 89.83, 91.15, 92.50, 93.98, 95.46, 96.80, 98.12));

        ModelKeyProvider<NormalValue> key = new ModelKeyProvider<NormalValue>()
        {
            @Override
            public String getKey(NormalValue normalValue) { return normalValue.getId(); }
        };

        ValueProvider<NormalValue, Double> xProvider = new ValueProvider<NormalValue, Double>()
        {
            @Override
            public Double getValue(NormalValue normalValue) { return normalValue.getX(); }
            @Override
            public void setValue(NormalValue normalValue, Double value) { }
            @Override
            public String getPath() { return "x"; }
        };

        ValueProvider<NormalValue, Double> yProvider = new ValueProvider<NormalValue, Double>()
        {
            @Override
            public Double getValue(NormalValue normalValue) { return normalValue.getY(); }
            @Override
            public void setValue(NormalValue normalValue, Double value) { }
            @Override
            public String getPath() { return "y"; }
        };

        ListStore<NormalValue> store = new ListStore<NormalValue>(key);
        store.setAutoCommit(true);
        store.addAll(normalValues);

        NumericAxis<NormalValue> xAxis = new NumericAxis<NormalValue>();
        xAxis.setPosition(Chart.Position.BOTTOM);
        xAxis.setDisplayGrid(true);
        xAxis.addField(xProvider);
        xAxis.setMinimum(60.0);
        xAxis.setMaximum(190.0);

        NumericAxis<NormalValue> yAxis = new NumericAxis<NormalValue>();
        yAxis.setPosition(Chart.Position.LEFT);
        yAxis.setDisplayGrid(true);
        yAxis.addField(yProvider);

        LineSeries<NormalValue> series = new LineSeries<NormalValue>();
        series.setXField(xProvider);
        series.setYField(yProvider);
        series.setYAxisPosition(Chart.Position.LEFT);
        series.setStroke(new RGB(0, 0, 255));

        Chart<NormalValue> chart = new Chart<NormalValue>(500, 400);
        chart.addAxis(xAxis);
        chart.addAxis(yAxis);
        chart.setStore(store);
        chart.addSeries(series);

        return chart;
    }

  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    class NormalValue
    {
        long id;
        double x = 0, y = 0;
        public NormalValue(long id, double... values) { this.id = id; this.x = values[0]; this.y = values[6]; }
        public String getId() { return Long.toString(id); }
        public double getX() { return x; }
        public double getY() { return y; }
    }
}