Search code examples
androidgraphwidthbar-chartshinobi

how to set the Shinobicharts column width fixed in Android?


I am facing a strange issue with ShinobiCharts[Android] column width for the below scenarios:

XAxis : Date <br>
YAxis : Double

Input 1: DataAdapter= {[00:00,0.0], [02:00,360] , [24:00,0.0] }
Output : below output#1 screenshot shows expected column width wit bar.

enter image description here

Input 2: DataAdapter={[00,0.0], [15:150.0], [24:00,0.0]}
Output : screenshot 2 shows a bar with more length of column which does not fit inside that bounds.

enter image description here

Input 3: DataAdapter={[00,0.0], [23:00,360.0] , [24:00,0.0]}
Output : screenshot 3 shows even bigger and bigger and column width.

enter image description here

If adapter all has 3 entries for that day, then every column width showed like screenshot 1.

Question is: I just wanted to know what am i missing here, and what api should I use to restrict this column width to shown only inside that bounds where it fits?

Please help me.

private Series createSeries(@NonNull final DataAdapter<Date, Integer> dataAdapter, @NonNull final String title, final int color) {
        final ColumnSeries series = new ColumnSeries();
        series.setDataAdapter(dataAdapter);
        series.setShownInLegend(true);
        series.setTitle(title);
        series.setSelectionMode(Series.SelectionMode.POINT_MULTIPLE);
        ColumnSeriesStyle style = series.getStyle();
        style.setAreaColor(color);
        style.setAreaColorGradient(color);
        style.setLineColor(color);
        series.setStackId(1);
        return series;
    }

Solution

  • Here is the solution to my own question.

    Problem: shinoby-version: shinobicharts-android-premium-1.7.2-0.jar

    from the below link , got to know that shinobycharts does not have api to control the width of the column (vertical bar) (scroll down and see (rippling posted this 22 January 2016)) its backlog item .

    [shinobicontrols.com/forum/shinobicontrols/2013/4/how-are-the-widths-of-columns-set]

    as per the attached screenshots, if there is no entry point for the first partition midnight 12- to early morning 4 [12-4] or [00-04] per a day on X-axis, the width of the column is uncontrollable.

    Solution: As a workaround or a proper fix, I just added a dummy entry in the first partition if there is no actual data. and the final adapter looks like below.

    If actual data presents for the 1st partition i.e [12-4] in screenshot. no need to add dummy here:
    earlier: DataAdapter= {[00:00,0.0],[02:00,360],[24:00,0.0] }
    now: DataAdapter= {[00:00,0.0],[02:00,360],[24:00,0.0] } //no change as it was earlier.

    if not:
    earlier: DataAdapter={[00,0.0], [15:150.0], [24:00,0.0]}
    now: DataAdapter= {[00:00,0.0],[02:00,0],[15:150.0],[24:00,0.0] }

    end entry [02:00, 0] is the dummy entry here. and does not mess up the output as the VALUE is set to Zero here.

    Output:#

    Without entry in the first partition 12-4

    With entry in the first partition 12-4