Barre de progression
by Guillaume Seguin
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/bullet.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<figure class="highcharts-figure">
<div id="container1"></div>
<div id="container2"></div>
<div id="container3"></div>
</figure>
CSS
#container1 {
height: 115px;
}
#container2, #container3 {
height: 85px;
}
.hc-cat-title {
font-size: 13px;
font-weight: bold;
}
.highcharts-figure, .highcharts-data-table table {
min-width: 320px;
max-width: 800px;
margin: 1em auto;
}
.highcharts-data-table table {
font-family: Verdana, sans-serif;
border-collapse: collapse;
border: 1px solid #EBEBEB;
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}
.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: #555;
}
.highcharts-data-table th {
font-weight: 600;
padding: 0.5em;
}
.highcharts-data-table td, .highcharts-data-table th, .highcharts-data-table caption {
padding: 0.5em;
}
.highcharts-data-table thead tr, .highcharts-data-table tr:nth-child(even) {
background: #f8f8f8;
}
.highcharts-data-table tr:hover {
background: #f1f7ff;
}
JavaScript
Highcharts.setOptions({
chart: {
inverted: true,
marginLeft: 135,
type: 'bullet'
},
title: {
text: null
},
legend: {
enabled: false
},
yAxis: {
gridLineWidth: 0
},
plotOptions: {
series: {
pointPadding: 0.25,
borderWidth: 0,
color: '#000',
targetOptions: {
width: '200%'
}
}
},
credits: {
enabled: false
},
exporting: {
enabled: false
}
});
Highcharts.chart('container1', {
chart: {
marginTop: 40
},
title: {
text: 'Analyse comparative des biens comparables'
},
xAxis: {
categories: ['<span class="hc-cat-title">Sortis du marché</span><br/>€/m²']
},
yAxis: [{
max: 12000,
min: 7000,
plotBands: [{
from: 7000,
to: 8000,
color: '#aedd94'
}, {
from: 8000,
to: 9000,
color: '#fef8a0'
}, {
from: 9000,
to: 10000,
color: '#ff8a84'
}],
labels: {
enabled: false
},
height: 40,
top: 50,
title: null
}],
series: [{
color: "#497cb1",
data: [{
dataLabels: {
color: "#497cb1",
enabled: true
},
y: 8264,
target: 8500
}]
}],
tooltip: {
pointFormat: 'Prix de vente : <b>{point.y} €</b> (avec une estimation à {point.target} €)'
}
});
Highcharts.chart('container2', {
xAxis: {
categories: ['<span class="hc-cat-title">Sur le marché</span><br/>€/m²']
},
yAxis: [{
max: 12000,
min: 7000,
plotBands: [{
from: 7200,
to: 8000,
color: '#aedd94'
}, {
from: 8000,
to: 9000,
color: '#fef8a0'
},...