Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant use multiple chart in same screen scrollview #41

Closed
MuthuSubramaniam opened this issue Sep 20, 2018 · 7 comments
Closed

Cant use multiple chart in same screen scrollview #41

MuthuSubramaniam opened this issue Sep 20, 2018 · 7 comments
Assignees

Comments

@MuthuSubramaniam
Copy link

MuthuSubramaniam commented Sep 20, 2018

I can't use multiple charts in single page using scrollview. If i use single then its view showing. If I use multiple then the view is not showing.

@Shestac92 Shestac92 self-assigned this Sep 20, 2018
@Shestac92
Copy link

@MuthuSubramaniam
Please, can you provide us your code to review it and suggest a proper solution?

@MuthuSubramaniam
Copy link
Author

MuthuSubramaniam commented Sep 20, 2018

`

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:weightSum="4">

        <com.anychart.AnyChartView
            android:id="@+id/any_chart_view"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <com.anychart.AnyChartView
            android:id="@+id/any_chart_view1"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <com.anychart.AnyChartView
            android:id="@+id/any_chart_view2"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <com.anychart.AnyChartView
            android:id="@+id/any_chart_view3"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

    </LinearLayout>
</ScrollView>

`

@Shestac92
Copy link

@MuthuSubramaniam
Thank you for the layout, but we need the code which creates the chart.

@MuthuSubramaniam
Copy link
Author

`
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) findViewById(R.id.any_chart_view);
    anyChartView.setChart(pie);

   AnyChartView anyChartView1 = (AnyChartView) findViewById(R.id.any_chart_view1);
    anyChartView1.setChart(pie);
  .
  .
  .
  .
  .

AnyChartView anyChartView5 = (AnyChartView) findViewById(R.id.any_chart_view5);
    anyChartView5.setChart(pie);

`

@Shestac92
Copy link

@MuthuSubramaniam
thank you!
Please, try the following approach:

List<DataEntry> data = new ArrayList<>();
data.add(new ValueDataEntry("Apples", 6371664));
data.add(new ValueDataEntry("Pears", 789622));
data.add(new ValueDataEntry("Bananas", 7216301));
data.add(new ValueDataEntry("Grapes", 1486621));
data.add(new ValueDataEntry("Oranges", 1200000));

AnyChartView anyChartView = findViewById(R.id.any_chart_view);
APIlib.getInstance().setActiveAnyChartView(anyChartView);

Pie pie = AnyChart.pie();

pie.data(data);

anyChartView.setChart(pie);

AnyChartView anyChartView1 = findViewById(R.id.any_chart_view1);
APIlib.getInstance().setActiveAnyChartView(anyChartView1);

Pie pie1 = AnyChart.pie();

pie1.data(data);

anyChartView1.setChart(pie1);

@Poissac9
Copy link

It didn't work for me

@ZhaziraD
Copy link

ZhaziraD commented Jun 3, 2022

Is there any other solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants