JSFiddle - React, Tailwind, and code Playground
by dnya_krishna
HTML
<?php
$dataPoints1Chart2 = array(array("x" => 6, "y" => 68 ),);
$dataPoints2Chart2 = array(array("x" => 6, "y" => 20),);
$dataPoints3Chart2 = array(array("x" => 6, "y" => [0,85] ,"color" => "black"),);
?>
<div id="chartContainerSecond" style="margin-top:20px;height: 200px; width: 100%;"></div>
JavaScript
window.onload = function() {
var chart = new CanvasJS.Chart("chartContainerSecond", {
// theme: "light2",
colorSet:"SecondChart",
axisX:{
gridThickness: 0,
tickLength: 0,
lineThickness: 0,
valueFormatString:" ",
labelFormatter: function(){
return "";
}
},
axisY:{
gridThickness: 0,
tickLength: 0,
lineThickness: 0,
valueFormatString:" ",
labelFormatter: function(){
return "";
}
},
data: [
{
type: "stackedBar100",
color: "#fdfa99",
fillOpacity: 0.8,
dataPoints: <?php echo json_encode($dataPoints1Chart2, JSON_NUMERIC_CHECK); ?>
},
{
type: "stackedBar100",
fillOpacity: 0.8,
dataPoints: <?php echo json_encode($dataPoints2Chart2, JSON_NUMERIC_CHECK); ?>
},
{
type: "error",
whiskerThickness: 0,
// color: "#49b24c",
indexLabelFormatter: function(e){
if(e.index === 1)
return e.dataPoint.y[1];
return "";
},
toolTipContent: "{x}: {y[1]}",
dataPoints: <?php echo json_encode($dataPoints3Chart2, JSON_NUMERIC_CHECK); ?>
}
]
});
chart.render();
}