Skip to content

Instantly share code, notes, and snippets.

@ArsenyMalkov
Created May 25, 2018 02:55
Show Gist options
  • Select an option

  • Save ArsenyMalkov/161252fc57cf5c4e5dc68dc00f3ae478 to your computer and use it in GitHub Desktop.

Select an option

Save ArsenyMalkov/161252fc57cf5c4e5dc68dc00f3ae478 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.anychart.anychart.AnyChartView
android:id="@+id/any_chart_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
public class TagCloudActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chart_common);
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
ProgressBar progressBar = findViewById(R.id.progress_bar);
anyChartView.setProgressBar(progressBar);
TagCloud tagCloud = AnyChart.tagCloud();
tagCloud.setTitle("World Population");
tagCloud.setAngles(new Double[] {-90d, 0d, 90d});
tagCloud.getColorRange().setEnabled(true);
tagCloud.getColorRange().setColorLineSize(15d);
List<DataEntry> data = new ArrayList<>();
data.add(new CategoryValueDataEntry("China", "asia", 1383220000));
data.add(new CategoryValueDataEntry("India", "asia", 1316000000));
data.add(new CategoryValueDataEntry("United States", "america", 324982000));
data.add(new CategoryValueDataEntry("Indonesia", "asia", 263510000));
data.add(new CategoryValueDataEntry("Brazil", "america", 207505000));
data.add(new CategoryValueDataEntry("Pakistan", "asia", 196459000));
data.add(new CategoryValueDataEntry("Nigeria", "africa", 191836000));
data.add(new CategoryValueDataEntry("Bangladesh", "asia", 162459000));
data.add(new CategoryValueDataEntry("Russia", "europe", 146804372));
data.add(new CategoryValueDataEntry("Japan", "asia", 126790000));
tagCloud.setData(data);
anyChartView.setChart(tagCloud);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment