1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| <html>
<div id="container" ></div>
<style type="text/css">
html, body, #container {
width: 90%;
height: 80%;
margin: 60px;
padding: 0;
}
</style>
</html>
<script>
anychart.onDocumentReady(function () {
// data
var data = anychart.data.set([
["Lundi", +resultprodLundiL1 , +resultprodLundiL2],
["Mardi", +resultprodMardiL1, +resultprodMardiL2],
["Mercredi", +resultprodMercrediL1 , +resultprodMercrediL2],
["Jeudi", +resultprodJeudiL1, +resultprodJeudiL2],
["Vendredi", +resultprodVendrediL1 , +resultprodVendrediL2]
]);
// map data for the each series
var Ligne1 = data.mapAs({x: 0, value: 1});
var Ligne2= data.mapAs({x: 0, value: 2});
// chart type
var chart = anychart.column();
// set data
var series_1 = chart.column(Ligne1);
series_1.name("Ligne 1");
series_1.xPointPosition(0.5);
var series_2 = chart.column(Ligne2);
series_2.name("Ligne 2");
series_1.fill("#3679D9");
series_2.fill("#D93636");
series_1.stroke("none");
series_2.stroke("none");
//BARRE DE SEUIL
var yAxis = chart.yAxis();
var marker = chart.lineMarker();
marker.axis(yAxis);
marker.value(350000);
marker.stroke('red 1', 3);
marker.zIndex(100);
var textMarker = chart.textMarker();
textMarker.axis(chart.yAxis());
textMarker.value(35000);
textMarker.align("right");
textMarker.anchor("right-bottom");
textMarker.fontSize(24);
textMarker.fontColor("red");
textMarker.offsetX(5);
textMarker.offsetY(320)
textMarker.text("Objectif");
chart.yAxis().title("Pochons");
// enable legend
chart.legend(true);
// switching the select mode to multi
var interactivity = chart.interactivity();
interactivity.selectionMode("single-select");
// draw
chart.container("container");
chart.draw();
});
</script> |
Partager