Drillable bar chart
Integration with Highcharts
HTML
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<script src="https://cdn.flexmonster.com/lib/flexmonster.highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/drilldown.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<div>
<h2>How to create a drillable bar chart</h2>
<p>
In integrations with charting libraries, Flexmonster serves as a data provider. If the chosen charting library supports drilling, you can create a drillable chart filled with data from Flexmonster.
</p>
<p>
The Highcharts library <a href="https://www.highcharts.com/docs/chart-concepts/drilldown" target="_blank">has drilling functionality</a>. To create a drillable Highcharts chart, use the <a href="https://www.flexmonster.com/doc/integration-with-highcharts/#withDrillDown" target="_blank">withDrilldown</a> option, which is provided by Flexmonster Connector for Highcharts. Specify <code>withDrilldown: true</code> (line 38 in the JavaScript box), and the Connector will prepare your data for a drillable chart.
</p>
<p>
In the below chart, you can drill down the <code>Country</code> level to see more details.
</p>
<p>
<a href="https://www.flexmonster.com/doc/integration-with-highcharts/" target="_blank">Visit our docs to learn more about the integration with Highcharts</a>.
</p>
</div>
<div id="pivot-container"></div>
<div id="chartContainer"></div>
CSS
#chartContainer {
margin: 20px;
}
h2 {
text-align: center;
}
p {
font-size: 15px;
line-height: 1.5;
padding-right: 10px;
padding-left: 10px;
}
a {
color: #00a45a;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
code {
font-size: 105%;
color: #DF3800;
background-color: #f5f5f5;
padding: 1px 4px;
font-family: monospace !important;
border-radius: 4px;
}
JavaScript
let pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
licenseFilePath: "https://cdn.flexmonster.com/jsfiddle.charts.key",
height: 270,
report: {
dataSource: {
filename: "data/data.csv"
},
slice: {
rows: [
{
uniqueName: "Price",
}
],
columns: [
{ uniqueName: "Business Type" },
{ uniqueName: "[Measures]" }
],
measures: [
{ uniqueName: "Quantity" }
]
}
},
reportcomplete: function() {
pivot.off("reportcomplete");
createBarWithDrilldown();
}
});
function createBarWithDrilldown() {
pivot.highcharts.getData(
{
type: "bar",
withDrilldown: true
},
createAndUpdateChart,
createAndUpdateChart
);
}
function createAndUpdateChart(chartConfig) {
chartConfig.title.text = "With Drilldown";
Highcharts.chart('chartContainer', chartConfig);
}