AnyChart / AnyChart-Android

AnyChart Android Chart is an amazing data visualization library for easily creating interactive charts in Android apps. It runs on API 19+ (Android 4.4) and features dozens of built-in chart types.
2.31k stars 369 forks source link

Charts are not displaying #250

Open ZeeshanCoding13 opened 2 years ago

ZeeshanCoding13 commented 2 years ago

Charts are not displaying at all. Only the watermark is shown at the bottom of the screen. Below is my code Activity.xml <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".AnalyticsFragment">

<com.anychart.AnyChartView
    android:id="@+id/pie_chart"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

AnalyticsFragment.java public class AnalyticsFragment extends Fragment {

ArrayList pieEntries;

public AnalyticsFragment() {
    // Required empty public constructor
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_analytics2, container, false);

    Pie pie = AnyChart.pie();

    List<DataEntry> data = new ArrayList<>();
    data.add(new ValueDataEntry("John", 10000));
    data.add(new ValueDataEntry("Jake", 12000));
    data.add(new ValueDataEntry("Peter", 18000));

    pie.data(data);

    AnyChartView anyChartView = (AnyChartView) view.findViewById(R.id.pie_chart);
    anyChartView.setChart(pie);

return view; }

Shestac92 commented 2 years ago

@SheroXee Unforutnately, we do not support Fragment. The only available approach to layout the Pie chart is described in the snippet.

venusaim23 commented 2 years ago

Hey @Shestac92 even I'm facing the same issue. The graphs are not shown, only the watermark. In my case, there are no fragments, only activities. I also tried to directly copy paste code from provided code snippets. Even that does not work.

I'm using v1.1.4

aeharake commented 1 year ago

@Shestac92 Any updates?

Alfie920 commented 1 year ago

I am having the same issue, with any of the Anychart's. I had it working temporarily, after installing Android Studio Flamingo, but unfortunately the issue returned upon updates to patch 1 and other updates to Android Studio.

@Shestac92 @aeharake @ZeeshanCoding13 @venusaim23

Any solution?

abora97 commented 1 year ago

any update i have same problem chart not displaying

abora97 commented 1 year ago

Any updates? @Shestac92 @aeharake @aeharake @venusaim23 @Alfie920

Alfie920 commented 1 year ago

@abora97 @Shestac92 @aeharake @venusaim23 I was able to correct the issues.

Documented on Stackoverflow.com here: https://stackoverflow.com/questions/75988346/i-am-getting-errors-implementing-a-heatmap-chart-using-anychart-via-android-stud/76111541#76111541[Anychart charts not drawing](https://stackoverflow.com/questions/75988346/i-am-getting-errors-implementing-a-heatmap-chart-using-anychart-via-android-stud/76111541#76111541)

I hope it helps you all.

abora97 commented 1 year ago

no still don't work