@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chart_common); AnyChartView anyChartView = findViewById(R.id.any_chart_view); anyChartView.setProgressBar(findViewById(R.id.progress_bar)); Pyramid pyramid = AnyChart.pyramid(); List<DataEntry> data = new ArrayList<>(); data.add(new ValueDataEntry("TV promotion", 6371664)); data.add(new ValueDataEntry("Radio promotion", 7216301)); data.add(new ValueDataEntry("Advertising leaflets", 1486621)); data.add(new ValueDataEntry("Before advertising started", 1386622)); pyramid.data(data); Legend legend = pyramid.legend(); legend.enabled(true); legend.position("outside-right"); legend.itemsLayout(LegendLayout.VERTICAL); legend.align(Align.TOP); pyramid.labels(false); anyChartView.setChart(pyramid); } }
.position("center-bottom") .itemsLayout(LegendLayout.HORIZONTAL) .align(Align.CENTER);
.padding(0d, 0d, 0d, 20d) .position(Orientation.RIGHT) .align(Align.TOP) .itemsLayout(LegendLayout.VERTICAL);
.align(Align.CENTER) .enabled(true);
.enabled(true) .position("center-top") .align(Align.CENTER) .itemsLayout(LegendLayout.HORIZONTAL) .padding(0, 0, 30, 0)