Radar chart
Integration with amCharts 5
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<script src="https://cdn.flexmonster.com/lib/flexmonster.amcharts.js"></script>
<script src="https://cdn.amcharts.com/lib/5/index.js"></script>
<script src="https://cdn.amcharts.com/lib/5/xy.js"></script>
<script src="https://cdn.amcharts.com/lib/5/radar.js"></script>
<script src="https://cdn.amcharts.com/lib/5/themes/Animated.js"></script>
<script src="https://cdn.amcharts.com/lib/5/themes/Kelly.js"></script>
<div id="pivotContainer">The component will appear here</div>
<div id="amcharts-container"></div>
CSS
@import url(https://cdn.flexmonster.com/assets/jsfiddle-styles.css);
#amcharts-container {
margin: 20px 0 20px 0;
height: 500px;
font-size: 15px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
JavaScript
let pivot = new Flexmonster({
container: "pivotContainer",
componentFolder: "https://cdn.flexmonster.com/",
licenseFilePath: "https://cdn.flexmonster.com/jsfiddle.charts.key",
toolbar: true,
height: 430,
report: {
dataSource: {
filename: "data/data.csv"
},
slice: {
rows: [{
uniqueName: "Country"
}],
columns: [{
uniqueName: "Color"
},
{
uniqueName: "[Measures]"
}
],
measures: [{
uniqueName: "Price",
format: "currency"
},
{
uniqueName: "Quantity",
format: "currency"
}
]
},
formats: [{
name: "currency",
thousandsSeparator: ",",
decimalSeparator: ".",
decimalPlaces: 2,
currencySymbol: "$",
currencySymbolAlign: "left",
nullValue: "",
textAlign: "right",
isPercent: false
}]
},
reportcomplete: function() {
pivot.off("reportcomplete");
createChart();
}
});
let chart;
let root;
function createChart() {
pivot.amcharts.getData({}, drawChart, updateChart);
}
function drawChart(chartConfig, rawData) {
// Create root element
root = am5.Root.new("amcharts-container");
root.numberFormatter.set("numberFormat", pivot.amcharts.getNumberFormatPattern(rawData.meta.formats[0]));
// Set themes
root.setThemes([
am5themes_Animated.new(root),
am5themes_Kelly.new(root)
]);
// Create chart
let chart = root.container.children.push(am5radar.RadarChart.new(root, {}));
// Create axes and their renderers
let xRenderer = am5radar.AxisRendererCircular.new(root, {});
xRenderer.labels.template.setAll({
radius: 25
});
let xAxis = chart.xAxes.push(am5xy.CategoryAxis.new(root, {
categoryField: pivot.amcharts.getCategoryName(rawData),
tooltip: am5.Tooltip.new(root, {}),
renderer: xRenderer
}));
let...