UNPKG

@amcharts/amcharts4

Version:
48 lines (40 loc) 1.09 kB
import * as am4core from "@amcharts/amcharts4/core"; import * as am4charts from "@amcharts/amcharts4/charts"; import am4themes_animated from "@amcharts/amcharts4/themes/animated"; am4core.useTheme(am4themes_animated); let chart = am4core.create("chartdiv", am4charts.SlicedChart); chart.data = [{ "name": "The first", "value": 600 }, { "name": "The second", "value": 300 }, { "name": "The third", "value": 200 }, { "name": "The fourth", "value": 180 }, { "name": "The fifth", "value": 50 }, { "name": "The sixth", "value": 20 }, { "name": "The seventh", "value": 10 }]; let series = chart.series.push(new am4charts.FunnelSeries()); series.colors.step = 2; series.dataFields.value = "value"; series.dataFields.category = "name"; series.alignLabels = true; series.labelsContainer.paddingLeft = 15; series.labelsContainer.width = 200; //series.orientation = "horizontal"; //series.bottomRatio = 1; chart.legend = new am4charts.Legend(); chart.legend.position = "left"; chart.legend.valign = "bottom"; chart.legend.margin(5,5,20,5);