1

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;
    }
ArK
  • 20,698
  • 67
  • 109
  • 136
  • Please post the image in the question itself. – Box Box Box Box Mar 26 '16 at 04:59
  • @AshishAhujaツ, to keep it clean, just added the links.. bye d way, do u know the problem here and what will be solution – Venkat Ballem Mar 26 '16 at 05:07
  • I don't know android, and I'm sorry that I can't help. But it will be nice if you can add the images in the question itself. – Box Box Box Box Mar 26 '16 at 05:09
  • @AshishAhujaツ, I tried, but as I do not have much reputation points, its not allowing me . so did this. thanks for quick response. – Venkat Ballem Mar 26 '16 at 05:11
  • You do not need reputation for editing your own question. Just click under the tag android on "edit", and edit the question. – Box Box Box Box Mar 26 '16 at 05:13
  • @AshishAhujaツ, No, it says "I need at least 10 reputation points" to embed images. sorry for the that. – Venkat Ballem Mar 26 '16 at 05:20
  • ^^ Oh, I didn't know that. No probs. – Box Box Box Box Mar 26 '16 at 05:30
  • still looking for the solution , it would be great if someone from shinobycontrols help me – Venkat Ballem Mar 28 '16 at 05:33
  • Finally I have found a work around solution to align all the bar column width irrespective of timing. for every DataAdapter just added a dummy entry at first partition e.g. DataAdapter= {[00:00,0.0], [02:00,0] , [10:00,150.0] [24:00,0.0] }.. that solves my issue with shinobycharts... – Venkat Ballem Mar 29 '16 at 12:17
  • @Balem, then post how you got it in a answer. It will help future visitors. – Box Box Box Box Mar 29 '16 at 12:18
  • @AshishAhujaツ, Yes only one dummy entry in the first partition [12-4] as shown in attached pics. dummy entry added[ 02:00 -> Zero value ]. I dont now how to make this question as answered – Venkat Ballem Mar 29 '16 at 12:22
  • @Balem, scroll your page a bit down. You'll see a button in blue color which has the words "Answer Your Question". Click on that. A box will appear. Then you type in that how you solve your question. Be sure to write in detail. If your answer is correct, it will get upvotes and you will get reputation. The other way if your answer is bad. – Box Box Box Box Mar 29 '16 at 12:27

2 Answers2

0

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

0

I am glad that you were able to resolve your issue.

As you have seen, the data itself can have a significant impact on the width at which the columns are drawn.

When the chart calculates the width at which to draw the column, amongst other things it looks at the distance between each data value for the relevant axis. It will choose the shortest distance between two data point values and base it’s column width calculation on this. This approach usually results in evenly spaced columns with a consistent width, except when the data point values have a varied frequency. For example if most of your data points have an x value 9 hours from it’s adjacent ones, but then one pair of x values are only 2 hours apart, you may experience this type of issue. Furthermore, a DateTime axis, when used with a column or bar chart can also result in varying column or bar widths because date frequencies are often varied. For example, for monthly data, some months have 31 days whereas some have 30, 28 or 29.

In the future we may look to provide additional api methods to allow manual setting of column width. I cannot of course give any firm indication of when such api will be available. In the meantime if you still experience issues with your column chart, please do get in touch by contacting info@shinobicontrols.com. In this instance please do include a code sample where possible, to help us to get up to speed with your issue quickly.

Thanks and kind regards, Kai

Disclaimer: I work for Shinobicontrols.

Kai
  • 186
  • 2
  • 10