Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function drilledData(point) {
- var data = {
- 'Region1_Central': [
- {
- name: 'Store1',
- id: 'Region1_Central_Store1',
- type: 'line',
- data: [58.6, 86.5, 65.8]
- },
- {
- name: 'Store2',
- id: 'Region1_Central_Store2',
- type: 'line',
- data: [86.5, 65.8, 58.6]
- }
- ],
- 'Region1_East': [
- {
- name: 'Store1',
- id: 'Region1_East_Store1',
- type: 'line',
- data: [58.6, 86.5, 65.8]
- },
- {
- name: 'Store2',
- id: 'Region1_East_Store2',
- type: 'line',
- data: [86.5, 65.8, 58.6]
- }
- ],
- 'Region1_West': [
- {
- name: 'Store1',
- id: 'Region1_West_Store1',
- type: 'line',
- data: [58.6, 86.5, 65.8]
- },
- {
- name: 'Store2',
- id: 'Region1_West_Store2',
- type: 'line',
- data: [86.5, 65.8, 58.6]
- }
- ],
- 'Region2_Central': [
- {
- name: 'Store1',
- id: 'Region2_Central_Store1',
- type: 'line',
- data: [58.6, 86.5, 65.8]
- },
- {
- name: 'Store2',
- id: 'Region2_Central_Store2',
- type: 'line',
- data: [86.5, 65.8, 58.6]
- }
- ],
- 'Region2_East': [
- {
- name: 'Store1',
- id: 'Region2_East_Store1',
- type: 'line',
- data: [58.6, 86.5, 65.8]
- },
- {
- name: 'Store2',
- id: 'Region2_East_Store2',
- type: 'line',
- data: [86.5, 65.8, 58.6]
- }
- ],
- 'Region2_West': [
- {
- name: 'Store1',
- id: 'Region2_West_Store1',
- type: 'line',
- data: [58.6, 86.5, 65.8]
- },
- {
- name: 'Store2',
- id: 'Region2_West_Store2',
- type: 'line',
- data: [86.5, 65.8, 58.6]
- }
- ]
- };
- return data[point];
- }
- // Create the chart
- Highcharts.chart('container', {
- chart: {
- type: 'line',
- events: {
- drilldown: function (e) {
- if (!e.seriesOptions) {
- var chart = this,
- drillSeries = drilledData(e.point.id);
- chart.addSingleSeriesAsDrilldown(e.point, drillSeries[0]);
- chart.addSingleSeriesAsDrilldown(e.point, drillSeries[1]);
- chart.applyDrilldown();
- }
- }
- }
- },
- title: {
- text: 'Demo customer widget(Multiple Levels' Drilldown)'
- },
- xAxis: {
- categories: ['Jan', 'Feb', 'Mar']
- },
- yAxis: [{ // Primary yAxis
- labels: {
- format: '{value}',
- style: {
- color: 'blue'
- }
- },
- title: {
- text: 'Average Score (in %)',
- style: {
- color: 'black'
- }
- }
- }
- ],
- tooltip: {
- headerFormat: '<b>{point.name}</b><br/>',
- pointFormat: '{series.name}: {point.y:.1f}%'
- },
- plotOptions: {
- line: {
- allowPointSelect: true,
- cursor: 'pointer',
- dataLabels: {
- enabled: true
- },
- showInLegend: true
- },
- series: {
- compare: 'percent'
- }
- },
- series: [{
- name: 'Region1',
- data: [{
- id: 'Region1_Central',
- name: 'Central',
- y: 60,
- drilldown: true
- }, {
- id: 'Region1_East',
- name: 'East',
- y: 30,
- drilldown: true
- }, {
- id: 'Region1_West',
- name: 'West',
- y: 40,
- drilldown: true
- }
- ]
- }, {
- name: 'Region2',
- data: [{
- id: 'Region2_Central',
- name: 'Central',
- y: 40,
- drilldown: true
- }, {
- id: 'Region2_East',
- name: 'East',
- y: 70,
- drilldown: true
- }, {
- id: 'Region2_West',
- name: 'West',
- y: 60,
- drilldown: true
- }
- ]
- }
- ]
- });
Add Comment
Please, Sign In to add comment