Chart not showing, but data is there
Opened this issue · 18 comments
Hi! I'm trying to use the AreaChart, but I'm sometimes getting this strange behavior:
As you can see, the chart is not rendered, but the data seems to have been applied.
Here is my code:
`AnyChartView propertyTypeChart = activity.findViewById(R.id.viewings_by_property_type_area_chart);
APIlib.getInstance().setActiveAnyChartView(propertyTypeChart);
propertyTypeAreaChart= AnyChart.area();
propertyTypeAreaChart.animation(true);
propertyTypeAreaChart.yScale().stackMode(ScaleStackMode.VALUE);
List<DataEntry> propertyTypeSeriesData = new ArrayList<>();
for (int i=0; i<period.size(); i++) {
List<Number> values = new ArrayList<>();
for (int z =0; z<responseBody.getTypeNames().size(); z++) {
boolean found = false;
if (responseBody.getTypeNames().get(z).getSeries().size() > 0) {
for (int x = 0; x < responseBody.getTypeNames().get(z).getSeries().size(); x++) {
if (formatter.format(period.get(i)).equals(responseBody.getTypeNames().get(z).getSeries().get(x).getMonthCreatedAt())) {
values.add(Math.round(responseBody.getTypeNames().get(z).getSeries().get(x).getValue()));
found = true;
}
}
if (!found) {
values.add(0);
}
}
}
if (values.size() > 0) {
propertyTypeSeriesData.add(new AreaChartDataEntry(prettyFormatter.format(period.get(i)), values));
Log.d(prettyFormatter.format(period.get(i)), values.toString() + " size: " + String.valueOf(values.size()));
}
}
propertyTypesSet = Set.instantiate();
propertyTypesSet.data(propertyTypeSeriesData);
List<Mapping> propertyTypesSerieData = new ArrayList<>();
propertyTypesSerieData.add(propertyTypesSet.mapAs("{ x: 'x', value: 'value' }"));
for (int i=1; i<responseBody.getTypeNames().size(); i++) {
propertyTypesSerieData.add(propertyTypesSet.mapAs("{ x: 'x', value: 'value" + String.valueOf(i) + "' }"));
}
for (int i = 0; i<responseBody.getTypeNames().size(); i++) {
Area series = propertyTypeAreaChart.area(propertyTypesSerieData.get(i));
series.color(ColorTemplate.DOMAIN_COLORS_TEXT[i % ColorTemplate.DOMAIN_COLORS_TEXT.length]); //String.valueOf(Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)))
series.name(responseBody.getTypeNames().get(i).getLabel());
series.stroke("0 #fff");
series.hovered().stroke("3 #fff");
series.hovered().markers().enabled(true);
series.hovered().markers()
.type(MarkerType.CIRCLE)
.size(4d)
.stroke("1.5 #fff");
series.markers().zIndex(100d);
}
propertyTypeAreaChart.legend().enabled(true);
propertyTypeAreaChart.legend().fontSize(13d);
propertyTypeAreaChart.legend().padding(0d, 0d, 20d, 0d);
propertyTypeAreaChart.legend().align(Align.CENTER);
propertyTypeAreaChart.legend().position("bottom");
propertyTypeAreaChart.xAxis(0).title(false);
propertyTypeAreaChart.yAxis(0).title(false);
propertyTypeAreaChart.interactivity().hoverMode(HoverMode.BY_X);
propertyTypeAreaChart.tooltip()
.displayMode(TooltipDisplayMode.UNION);
propertyTypeChart.setChart(propertyTypeAreaChart);`
Any insight would be very appreciated!
@laurachelaru
Please, try to plot only a single area series (the first typeName) just for a test and let us know about the result. I mean excluding the loop of creating several series. This will show is there rendering problem or the problem comes from another issue.
Hi!
I have here a chart with only one area series:
`AnyChartView discountChart = activity.findViewById(R.id.discount_chart);
APIlib.getInstance().setActiveAnyChartView(discountChart);
discountAreaChart = AnyChart.area();
discountAreaChart.animation(true);
discountAreaChart.yScale().stackMode(ScaleStackMode.VALUE);
List<DataEntry> discountSeriesData = new ArrayList<>();
for (int i=0; i<period.size(); i++) {
List<Number> values = new ArrayList<>();
for (int z =0; z<responseBody.getTransactionsDiscount().size(); z++) {
if (formatter.format(period.get(i)).equals(responseBody.getTransactionsDiscount().get(z).getMonthCreatedAt())) {
values.add(Math.round(responseBody.getTransactionsDiscount().get(z).getValue()));
}
}
if (values.size() > 0) {
discountSeriesData.add(new AreaChartDataEntry(prettyFormatter.format(period.get(i)), values));
Log.d("discount " + prettyFormatter.format(period.get(i)), values.toString() + " size: " + String.valueOf(values.size()));
}
}
discountSet = Set.instantiate();
discountSet.data(discountSeriesData);
Mapping discountSeries1Data = discountSet.mapAs("{ x: 'x', value: 'value' }");
Area series1 = discountAreaChart.area(discountSeries1Data);
series1.color(ColorTemplate.DOMAIN_COLORS_TEXT[0]);
series1.name(activity.getResources().getString(R.string.discount));
series1.stroke("0 #fff");
series1.hovered().stroke("3 #fff");
series1.hovered().markers().enabled(true);
series1.hovered().markers()
.type(MarkerType.CIRCLE)
.size(4d)
.stroke("1.5 #fff");
series1.markers().zIndex(100d);
discountAreaChart.legend().enabled(true);
discountAreaChart.legend().fontSize(13d);
discountAreaChart.legend().padding(0d, 0d, 20d, 0d);
discountAreaChart.legend().align(Align.CENTER);
discountAreaChart.legend().position("bottom");
discountAreaChart.xAxis(0).title(false);
discountAreaChart.yAxis(0).title(false);
discountAreaChart.interactivity().hoverMode(HoverMode.BY_X);
discountAreaChart.tooltip()
.displayMode(TooltipDisplayMode.UNION);
discountChart.setChart(discountAreaChart);`
The result, unfortunately, is the same:
I have noticed that sometimes (not all the time), if I rotate the screen, the chart will appear.
@laurachelaru
I tried to reproduce the issue using your code, I have applied dummy data and series name/color (these were the only difference) and it works well on AVD. For tests, I used Android 8.1 API 27.
The text code and result screenshot are below:
APIlib.getInstance().setActiveAnyChartView(anyChartView);
Cartesian discountAreaChart = AnyChart.area();
discountAreaChart.animation(true);
discountAreaChart.yScale().stackMode(ScaleStackMode.VALUE);
List<DataEntry> discountSeriesData = new ArrayList<>();
discountSeriesData.add(new ValueDataEntry("John", 10000));
discountSeriesData.add(new ValueDataEntry("Jake", 12000));
discountSeriesData.add(new ValueDataEntry("Peter", 18000));
discountSeriesData.add(new ValueDataEntry("Mark", 4000));
Set discountSet = Set.instantiate();
discountSet.data(discountSeriesData);
Mapping discountSeries1Data = discountSet.mapAs("{ x: 'x', value: 'value' }");
Area series1 = discountAreaChart.area(discountSeries1Data);
series1.color("purple");
series1.name("Area series");
series1.stroke("0 #fff");
series1.hovered().stroke("3 #fff");
series1.hovered().markers().enabled(true);
series1.hovered().markers()
.type(MarkerType.CIRCLE)
.size(4d)
.stroke("1.5 #fff");
series1.markers().zIndex(100d);
discountAreaChart.legend().enabled(true);
discountAreaChart.legend().fontSize(13d);
discountAreaChart.legend().padding(0d, 0d, 20d, 0d);
discountAreaChart.legend().align(Align.CENTER);
discountAreaChart.legend().position("bottom");
discountAreaChart.xAxis(0).title(false);
discountAreaChart.yAxis(0).title(false);
discountAreaChart.interactivity().hoverMode(HoverMode.BY_X);
discountAreaChart.tooltip()
.displayMode(TooltipDisplayMode.UNION);
anyChartView.setChart(discountAreaChart);
Please, can you specify a few details?
-
Does the data which is applied to the chart include more than one point? The area series is a continuous series, it requires at least two points to get rendered. If your data includes only one point it may look like it's empty. Please, check the real content of the data before applying to the chart.
-
The API version you are using for tests (in case of AVD)
Hello! Yes, the data includes more than one point; Here's my code with no loops at all:
`APIlib.getInstance().setActiveAnyChartView(discountChart);
discountAreaChart = AnyChart.area();
discountAreaChart.animation(true);
discountAreaChart.yScale().stackMode(ScaleStackMode.VALUE);
List<DataEntry> discountSeriesData = new ArrayList<>();
List<Number> values1 = new ArrayList<>();
values1.add(0);
discountSeriesData.add(new AreaChartDataEntry("apr. 2017", values1));
List<Number> values2 = new ArrayList<>();
values2.add(0);
discountSeriesData.add(new AreaChartDataEntry("mai. 2017", values2));
List<Number> values3 = new ArrayList<>();
values3.add(-3363324);
discountSeriesData.add(new AreaChartDataEntry("iun. 2017", values3));
List<Number> values4 = new ArrayList<>();
values4.add(1116766);
discountSeriesData.add(new AreaChartDataEntry("iul. 2017", values4));
List<Number> values5 = new ArrayList<>();
values5.add(2500);
discountSeriesData.add(new AreaChartDataEntry("aug. 2017", values5));
List<Number> values6 = new ArrayList<>();
values6.add(4875);
discountSeriesData.add(new AreaChartDataEntry("sept. 2017", values6));
List<Number> values7 = new ArrayList<>();
values7.add(-30000);
discountSeriesData.add(new AreaChartDataEntry("oct. 2017", values7));
List<Number> values8 = new ArrayList<>();
values8.add(0);
discountSeriesData.add(new AreaChartDataEntry("nov. 2017", values8));
List<Number> values9 = new ArrayList<>();
values9.add(0);
discountSeriesData.add(new AreaChartDataEntry("dec. 2017", values9));
List<Number> values10 = new ArrayList<>();
values10.add(0);
discountSeriesData.add(new AreaChartDataEntry("ian. 2018", values10));
List<Number> values11 = new ArrayList<>();
values11.add(0);
discountSeriesData.add(new AreaChartDataEntry("feb. 2018", values11));
List<Number> values12 = new ArrayList<>();
values12.add(0);
discountSeriesData.add(new AreaChartDataEntry("mar. 2018", values12));
List<Number> values13 = new ArrayList<>();
values13.add(0);
discountSeriesData.add(new AreaChartDataEntry("apr. 2018", values13));
List<Number> values14 = new ArrayList<>();
values14.add(0);
discountSeriesData.add(new AreaChartDataEntry("mai 2018", values14));
List<Number> values15 = new ArrayList<>();
values15.add(0);
discountSeriesData.add(new AreaChartDataEntry("iun. 2018", values15));
List<Number> values16 = new ArrayList<>();
values16.add(0);
discountSeriesData.add(new AreaChartDataEntry("iul. 2018", values16));
List<Number> values17 = new ArrayList<>();
values17.add(0);
discountSeriesData.add(new AreaChartDataEntry("aug. 2018", values17));
List<Number> values18 = new ArrayList<>();
values18.add(0);
discountSeriesData.add(new AreaChartDataEntry("sept. 2018", values18));
List<Number> values19 = new ArrayList<>();
values19.add(0);
discountSeriesData.add(new AreaChartDataEntry("oct. 2018", values19));
List<Number> values20 = new ArrayList<>();
values20.add(0);
discountSeriesData.add(new AreaChartDataEntry("nov. 2018", values20));
List<Number> values21 = new ArrayList<>();
values21.add(0);
discountSeriesData.add(new AreaChartDataEntry("dec. 2018", values21));
List<Number> values22 = new ArrayList<>();
values22.add(0);
discountSeriesData.add(new AreaChartDataEntry("ian. 2019", values22));
List<Number> values23 = new ArrayList<>();
values23.add(0);
discountSeriesData.add(new AreaChartDataEntry("feb. 2019", values23));
List<Number> values24 = new ArrayList<>();
values24.add(0);
discountSeriesData.add(new AreaChartDataEntry("mar. 2019", values24));
List<Number> values25 = new ArrayList<>();
values25.add(99001);
discountSeriesData.add(new AreaChartDataEntry("apr. 2019", values25));
List<Number> values26 = new ArrayList<>();
values26.add(0);
discountSeriesData.add(new AreaChartDataEntry("mai 2019", values26));
List<Number> values27 = new ArrayList<>();
values27.add(0);
discountSeriesData.add(new AreaChartDataEntry("iun. 2017", values27));
discountSet = Set.instantiate();
discountSet.data(discountSeriesData);
Mapping discountSeries1Data = discountSet.mapAs("{ x: 'x', value: 'value' }");
Area series1 = discountAreaChart.area(discountSeries1Data);
series1.color(ColorTemplate.DOMAIN_COLORS_TEXT[0]);
series1.name(activity.getResources().getString(R.string.discount));
series1.stroke("0 #fff");
series1.hovered().stroke("3 #fff");
series1.hovered().markers().enabled(true);
series1.hovered().markers()
.type(MarkerType.CIRCLE)
.size(4d)
.stroke("1.5 #fff");
series1.markers().zIndex(100d);
discountAreaChart.legend().enabled(true);
discountAreaChart.legend().fontSize(13d);
discountAreaChart.legend().padding(0d, 0d, 20d, 0d);
discountAreaChart.legend().align(Align.CENTER);
discountAreaChart.legend().position("bottom");
discountAreaChart.xAxis(0).title(false);
discountAreaChart.yAxis(0).title(false);
discountAreaChart.interactivity().hoverMode(HoverMode.BY_X);
discountAreaChart.tooltip()
.displayMode(TooltipDisplayMode.UNION);
discountChart.setChart(discountAreaChart);`
My AreaChartDataEntry looks like this:
private class AreaChartDataEntry extends ValueDataEntry { AreaChartDataEntry(String x, List<Number> values) { super(x, values.get(0)); for (int i=1; i<values.size(); i++) { setValue("value"+String.valueOf(i), values.get(i)); } } }
I am encountering the same issue; the chart doesn't appear but I get the marker when I click on the screen. I'm using API level 26 for testing.
@laurachelaru
In your code, you are using custom made class AreaChartDataEntry
, which is not described in your snippet. I can assume that the problem may come from the implementation of this class. The chart data should be a list of instances with properties such as X, Value. According to the code, the AreaChartDataEntry
includes List. This can bring problems as it doesn't match the mapping "{ x: 'x', value: 'value' }"
.
I have created a chart based on your code, but I replaced the AreaChartDataEntry
with default ValueDataEntry
and applied the same values as in your code. The chart works well in this case. Below is the modified part of the code I used for tests and the resulting chart. The rest of the code remains the same as in your snippet.
Please, try to the default ValueDataEntry
instead of custom made AreaChartDataEntry
as it suits the case.
List<DataEntry> discountSeriesData = new ArrayList<>();
discountSeriesData.add(new ValueDataEntry("apr. 2017", 0));
discountSeriesData.add(new ValueDataEntry("mai. 2017", 0));
discountSeriesData.add(new ValueDataEntry("iun. 2017", -3363324));
discountSeriesData.add(new ValueDataEntry("iul. 2017", 1116766));
discountSeriesData.add(new ValueDataEntry("aug. 2017", 2500));
discountSeriesData.add(new ValueDataEntry("sept. 2017", 4875));
discountSeriesData.add(new ValueDataEntry("oct. 2017", -30000));
discountSeriesData.add(new ValueDataEntry("nov. 2017", 0));
Set discountSet = Set.instantiate();
discountSet.data(discountSeriesData);
Mapping discountSeries1Data = discountSet.mapAs("{ x: 'x', value: 'value' }");
I've tried using ValueDataEntry, which gets it to work the first time I load the page, but if I go back and then try to load the page again, I'm getting that same behavior.
I should mention, I'm trying to show the chart in a tab, on my page, for which I use TabHost. I've tried the code without the tabs and it seems to be working well. However, I can't dispense with the implementation because of the app's design.
Here is a simplified version of my code, which results in the behavior about 70% of the time:
Layout:
'
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TabHost
android:id="@+id/tab_host"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1">
<LinearLayout
android:id="@+id/area1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:id="@+id/area2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.anychart.AnyChartView
android:id="@+id/discount_area_chart"
android:layout_width="match_parent"
android:layout_height="300dp"
/>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
'
Class:
`public class TestAreaChart extends Fragment {
@BindView(R.id.tab_host)
protected TabHost tabHost;
@Override
public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.test_area_chart, container, false);
ButterKnife.bind(this, view);
//changeButton.setOnClickListener(this);
tabHost.setup();
//Tab 1
TabHost.TabSpec spec = tabHost.newTabSpec(getActivity().getResources().getString(R.string.personal_details));
spec.setContent(R.id.area1);
spec.setIndicator("", ContextCompat.getDrawable(getActivity(), R.drawable.icon_pie_chart));
tabHost.addTab(spec);
//Tab 2
spec = tabHost.newTabSpec(getActivity().getResources().getString(R.string.requests));
spec.setContent(R.id.area2);
spec.setIndicator("", ContextCompat.getDrawable(getActivity(), R.drawable.icon_bar_chart));
tabHost.addTab(spec);
return view;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
AnyChartView discountChart = getActivity().findViewById(R.id.discount_area_chart);
APIlib.getInstance().setActiveAnyChartView(discountChart);
Cartesian discountAreaChart = AnyChart.area();
discountAreaChart.animation(true);
discountAreaChart.yScale().stackMode(ScaleStackMode.VALUE);
List<DataEntry> discountSeriesData = new ArrayList<>();
List<Number> values1 = new ArrayList<>();
values1.add(0);
discountSeriesData.add(new ValueDataEntry ("apr. 2017", 0));
List<Number> values2 = new ArrayList<>();
values2.add(0);
discountSeriesData.add(new ValueDataEntry ("mai. 2017", 0));
List<Number> values3 = new ArrayList<>();
values3.add(-3363324);
discountSeriesData.add(new ValueDataEntry ("iun. 2017", -3363324));
List<Number> values4 = new ArrayList<>();
values4.add(1116766);
discountSeriesData.add(new ValueDataEntry ("iul. 2017", 1116766));
List<Number> values5 = new ArrayList<>();
values5.add(2500);
discountSeriesData.add(new ValueDataEntry ("aug. 2017", 2500));
List<Number> values6 = new ArrayList<>();
values6.add(4875);
discountSeriesData.add(new ValueDataEntry ("sept. 2017", 4875));
List<Number> values7 = new ArrayList<>();
values7.add(-30000);
discountSeriesData.add(new ValueDataEntry ("oct. 2017", -30000));
List<Number> values8 = new ArrayList<>();
values8.add(0);
discountSeriesData.add(new ValueDataEntry ("nov. 2017", 0));
List<Number> values9 = new ArrayList<>();
values9.add(0);
discountSeriesData.add(new ValueDataEntry ("dec. 2017", 0));
List<Number> values10 = new ArrayList<>();
values10.add(0);
discountSeriesData.add(new ValueDataEntry ("ian. 2018", 0));
List<Number> values11 = new ArrayList<>();
values11.add(0);
discountSeriesData.add(new ValueDataEntry ("feb. 2018", 0));
List<Number> values12 = new ArrayList<>();
values12.add(0);
discountSeriesData.add(new ValueDataEntry ("mar. 2018", 0));
List<Number> values13 = new ArrayList<>();
values13.add(0);
discountSeriesData.add(new ValueDataEntry ("apr. 2018", 0));
List<Number> values14 = new ArrayList<>();
values14.add(0);
discountSeriesData.add(new ValueDataEntry ("mai 2018", 0));
List<Number> values15 = new ArrayList<>();
values15.add(0);
discountSeriesData.add(new ValueDataEntry ("iun. 2018", 0));
List<Number> values16 = new ArrayList<>();
values16.add(0);
discountSeriesData.add(new ValueDataEntry ("iul. 2018", 0));
List<Number> values17 = new ArrayList<>();
values17.add(0);
discountSeriesData.add(new ValueDataEntry ("aug. 2018", 0));
List<Number> values18 = new ArrayList<>();
values18.add(0);
discountSeriesData.add(new ValueDataEntry ("sept. 2018", 0));
List<Number> values19 = new ArrayList<>();
values19.add(0);
discountSeriesData.add(new ValueDataEntry ("oct. 2018", 0));
List<Number> values20 = new ArrayList<>();
values20.add(0);
discountSeriesData.add(new ValueDataEntry ("nov. 2018", 0));
List<Number> values21 = new ArrayList<>();
values21.add(0);
discountSeriesData.add(new ValueDataEntry ("dec. 2018", 0));
List<Number> values22 = new ArrayList<>();
values22.add(0);
discountSeriesData.add(new ValueDataEntry ("ian. 2019", 0));
List<Number> values23 = new ArrayList<>();
values23.add(0);
discountSeriesData.add(new ValueDataEntry ("feb. 2019", 0));
List<Number> values24 = new ArrayList<>();
values24.add(0);
discountSeriesData.add(new ValueDataEntry ("mar. 2019", 0));
List<Number> values25 = new ArrayList<>();
values25.add(99001);
discountSeriesData.add(new ValueDataEntry ("apr. 2019", 99001));
List<Number> values26 = new ArrayList<>();
values26.add(0);
discountSeriesData.add(new ValueDataEntry ("mai 2019", 0));
List<Number> values27 = new ArrayList<>();
values27.add(0);
discountSeriesData.add(new ValueDataEntry ("iun. 2017", 0));
Set discountSet = Set.instantiate();
discountSet.data(discountSeriesData);
Mapping discountSeries1Data = discountSet.mapAs("{ x: 'x', value: 'value' }");
Area series1 = discountAreaChart.area(discountSeries1Data);
series1.color(ColorTemplate.DOMAIN_COLORS_TEXT[0]);
series1.name(getActivity().getResources().getString(R.string.discount));
series1.stroke("0 #fff");
series1.hovered().stroke("3 #fff");
series1.hovered().markers().enabled(true);
series1.hovered().markers()
.type(MarkerType.CIRCLE)
.size(4d)
.stroke("1.5 #fff");
series1.markers().zIndex(100d);
discountAreaChart.legend().enabled(true);
discountAreaChart.legend().fontSize(13d);
discountAreaChart.legend().padding(0d, 0d, 20d, 0d);
discountAreaChart.legend().align(Align.CENTER);
discountAreaChart.legend().position("bottom");
discountAreaChart.xAxis(0).title(false);
discountAreaChart.yAxis(0).title(false);
discountAreaChart.interactivity().hoverMode(HoverMode.BY_X);
discountAreaChart.tooltip()
.displayMode(TooltipDisplayMode.UNION);
discountChart.setChart(discountAreaChart);
}
}`
Any insight on why this is happening will be very appreciated.
@laurachelaru
The issue is not related to the data List, with high probability, it comes from managing views.
Try to set the chart active every time the users switches to the tab with the area chart:
APIlib.getInstance().setActiveAnyChartView(discountChart);
Does switching tabs calls recreating the chart?
@laurachelaru
I will try to reproduce the issue using your layout, it will take some to analyze the issue. I will update you as I get results!
well, I have an issue like this, but nothing works.
I got 2 charts inside fragments on a ViewPager, but just one of them work. If i remove someone the other magically works.
Tried with this on both charts
APIlib.getInstance().setActiveAnyChartView(anyChartView1);
but doesnt work at all, so I dont have any clue.
can anyone help me?
@IexeDev
We are working on the issue of rendering charts in Fragments. We will update you as we get results. Thank you for your report!
Hi! Any updates on this issue?
@laurachelaru
Unfortunately, at the moment the issue is not solved yet. We are still working on it.
hello @Shestac92 ,i have same problem setActiveAnyChartView work fine if multiple chart in activity, but it not works in fragment with viewpager,Any updates on this issue? please share how to fix this..thanks
@IexeDev
We are working on the issue of rendering charts in Fragments. We will update you as we get results. Thank you for your report!
Has this been resolved?
Hey all men,
As on my Android device from Hotwav running Android 12, I have to reload my app by pressing Home button then App-Overview button (next to Back button or Home button) and unload my app, then I rerun my app again and it just works I mean it shows my charts after a few seconds.
By the way, if you want to show many charts on the same layout/activity. You have to follow strictly this protocol/procedure: "Activate then set chart for every of them in series" like this (in Kotlin):
APIlib.getInstance().setActiveAnyChartView(mychartView);
mychartView.setChart(loadlinechart())
APIlib.getInstance().setActiveAnyChartView(mychartView2);
mychartView2.setChart(loadlinechart1())
APIlib.getInstance().setActiveAnyChartView(mychartView3);
mychartView3.setChart(loadPolarChart())
@laurachelaru
Hi! Is your issue fixed?