Duplicate Shinobi Control Legend on Android


#1

Hi,

I display the shinobi graph in Android fragment. For the first time, everything is displayed correctly. When click to other fragment, and then go to the same Android fragment again, for the subsequent tiimes, the legend is displayed twice or many times. May i know how to fix that?

 

Thanks,

victor

PS: the code to display legend is below:

        Legend legend = shinobiChart.getLegend();

        // Make the legend visible

        legend.setVisibility(View.VISIBLE);

        legend.setPosition(Legend.Position.BOTTOM_CENTER);        

        // Change the legend’s style

        LegendStyle legendStyle = legend.getStyle();

        legendStyle.setPadding(10.0f);

        legendStyle.setSymbolLabelGap(2.0f);

        legendStyle.setSymbolWidth(15.0f);

        legendStyle.setTextSize(13.0f);


#2

Hi Victor,

It looks like rather than the legend being added multiple times, it’s the same series that is being added multiple times to the chart.

Is it possible for you to send us the code for your app, or just some sample code that exhibits the same probelm, to info@shinobicontrols.com so we can investigate further?

Kind regards,

Patrick


#3

Hi Patrick,

Sure. I will send the code to info@shinobicontrols.com soon. 

Thanks,

Victor


#4

Indeed, remove the series and xAxis from the beginning, seems to help solve the duplicate Shinobi legend problem. Nonetheless, is there any function to reset (start afresh) the Shinobi graph before adding any series to it?

List<Series<?>> series = shinobiChart.getSeries();

for (Series<?> o : series) {

shinobiChart.removeSeries(o);

}

Axis<?, ?> axis = shinobiChart.getXAxis();

if (axis != null)

shinobiChart.removeXAxis(axis);


#5

Hi Victor,

Just to let you know I’ve replied to your email.

Kind regards,

Patrick