Last active
March 19, 2018 09:38
-
-
Save amelieykw/ab82616208d4f0f56cfa70ad3d6d31fe to your computer and use it in GitHub Desktop.
[Highcharts - Gauge series] #GaugeSeries #Highcharts #AmadeusIntern2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://code.highcharts.com/highcharts.js"></script> | |
<script src="https://code.highcharts.com/highcharts-more.js"></script> | |
<script src="https://code.highcharts.com/modules/exporting.js"></script> | |
<div id="container" style="min-width: 310px; max-width: 400px; height: 300px; margin: 0 auto"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Highcharts.chart('container', { | |
chart: { | |
type: 'gauge', | |
backgroundColor: 'transparent', | |
plotBackgroundColor: null, | |
plotBackgroundImage: null, | |
plotBorderWidth: 0, | |
plotShadow: false | |
}, | |
title: { | |
text: '' | |
}, | |
pane: { | |
startAngle: -150, | |
endAngle: 150, | |
size: '90%', | |
background: [{ | |
backgroundColor: { | |
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | |
stops: [ | |
[0, '#FFF'], | |
[1, '#333'] | |
] | |
}, | |
borderWidth: 0, | |
outerRadius: '109%' | |
}, { | |
backgroundColor: { | |
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | |
stops: [ | |
[0, '#333'], | |
[1, '#FFF'] | |
] | |
}, | |
borderWidth: 1, | |
outerRadius: '107%' | |
}, { | |
// default background | |
}, { | |
backgroundColor: '#DDD', | |
borderWidth: 0, | |
outerRadius: '105%', | |
innerRadius: '103%' | |
}] | |
}, | |
// the value axis | |
yAxis: { | |
min: 0, | |
max: 100, | |
minorTickInterval: 'auto', | |
minorTickWidth: 1, | |
minorTickLength: 10, | |
minorTickPosition: 'inside', | |
minorTickColor: '#666', | |
tickPixelInterval: 30, | |
tickWidth: 2, | |
tickPosition: 'inside', | |
tickLength: 10, | |
tickColor: '#666', | |
labels: { | |
step: 2, | |
rotation: 'auto' | |
}, | |
title: { | |
text: '' | |
}, | |
plotBands: [{ | |
from: 50, | |
to: 100, | |
color: '#55BF3B' // green | |
}, { | |
from: 20, | |
to: 50, | |
color: '#DDDF0D' // yellow | |
}, { | |
from: 0, | |
to: 20, | |
color: '#DF5353' // red | |
}] | |
}, | |
series: [{ | |
name: '', | |
data: [80], | |
dataLabels: { | |
style: { | |
fontSize: '50px' | |
}, | |
borderColor: null, | |
y: 50 | |
} | |
}] | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://code.highcharts.com/highcharts.js"></script> | |
<script src="https://code.highcharts.com/highcharts-more.js"></script> | |
<script src="https://code.highcharts.com/modules/exporting.js"></script> | |
<div id="container" style="min-width: 310px; max-width: 400px; height: 300px; margin: 0 auto"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Highcharts.chart('container', { | |
chart: { | |
type: 'gauge', | |
backgroundColor: 'transparent', | |
plotBackgroundColor: null, | |
plotBackgroundImage: null, | |
plotBorderWidth: 0, | |
plotShadow: false | |
}, | |
title: { | |
text: '' | |
}, | |
pane: { | |
startAngle: -150, | |
endAngle: 150, | |
size: '90%', | |
background: [{ | |
backgroundColor: { | |
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | |
stops: [ | |
[0, '#FFF'], | |
[1, '#333'] | |
] | |
}, | |
borderWidth: 0, | |
outerRadius: '109%' | |
}, { | |
backgroundColor: { | |
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | |
stops: [ | |
[0, '#333'], | |
[1, '#FFF'] | |
] | |
}, | |
borderWidth: 1, | |
outerRadius: '107%' | |
}, { | |
// default background | |
}, { | |
backgroundColor: '#DDD', | |
borderWidth: 0, | |
outerRadius: '105%', | |
innerRadius: '103%' | |
}] | |
}, | |
// the value axis | |
yAxis: { | |
min: -100, | |
max: 100, | |
minorTickInterval: 'auto', | |
minorTickWidth: 1, | |
minorTickLength: 10, | |
minorTickPosition: 'inside', | |
minorTickColor: '#666', | |
tickPixelInterval: 30, | |
tickWidth: 2, | |
tickPosition: 'inside', | |
tickLength: 10, | |
tickColor: '#666', | |
labels: { | |
step: 2, | |
rotation: 'auto' | |
}, | |
title: { | |
text: '%', | |
style:{ | |
fontSize: '40px' | |
}, | |
y: 16 | |
}, | |
plotBands: [{ | |
from: 50, | |
to: 100, | |
color: '#55BF3B' // green | |
}, { | |
from: 0, | |
to: 50, | |
color: '#DDDF0D' // yellow | |
}, { | |
from: -100, | |
to: 0, | |
color: '#DF5353' // red | |
}] | |
}, | |
series: [{ | |
name: '', | |
data: [2], | |
dataLabels: { | |
style: { | |
fontSize: '50px' | |
}, | |
borderColor: null, | |
y: 50 | |
} | |
}] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment