I got custom formatter that I found in other thread, that helps with setting strings as horizontal label.
GraphViewSeries series = new GraphViewSeries(new GraphView.GraphViewData[] {
new GraphView.GraphViewData(0, 14d),
new GraphView.GraphViewData(1, 7d),
new GraphView.GraphViewData(2, 12d),
new GraphView.GraphViewData(3, 10d),
new GraphView.GraphViewData(4, 14d),
new GraphView.GraphViewData(5, 8d),
new GraphView.GraphViewData(6, 25d),
new GraphView.GraphViewData(7, 10d),
new GraphView.GraphViewData(8, 14d),
new GraphView.GraphViewData(9, 7d),
new GraphView.GraphViewData(10, 5d),
});
GraphView graphView = new BarGraphView(this, "Demo");
graphView.addSeries(series);
horizontalLabels = new String[]{"1", "2", "3", "4", "5", "6",
"7", "8", "9", "10", "11"};
graphView.setViewPort(0, 3);
graphView.setScrollable(true);
graphView.setManualYAxisBounds(30, 0);
graphView.getGraphViewStyle().setNumVerticalLabels(6);
graphView.getGraphViewStyle().setNumHorizontalLabels(5);
//graphView.getGraphViewStyle().setTextSize();
graphView.setCustomLabelFormatter(new CustomLabelFormatter() {
@Override
public String formatLabel(double value, boolean isValueX) {
if (isValueX) {
return horizontalLabels[(int) value];
} else
return null;
}
});
LinearLayout layout = (LinearLayout) findViewById(R.id.graph1);
layout.addView(graphView);
This is my whole code that is handling graphView. I can't find any part that could made that weird doubling of values, but I am using this library for first time and maybe there is some tweaks to fix this.
It looks like this, when I scroll the graph it still doubling values. There are always 2 same values on screen, no matter where I scroll this.
EDIT: In this screens horizontal labels should be 1, 2, 3, 4, 5 - if it changes anything.