buble chart changed by stacked bar chart

parent b44620bd
...@@ -146,12 +146,18 @@ function change(newType) { ...@@ -146,12 +146,18 @@ function change(newType) {
} }
// Chart.js modifies the object you pass in. Pass a copy of the object so we can use the original object later // Chart.js modifies the object you pass in. Pass a copy of the object so we can use the original object later
var temp = jQuery.extend(true, {}, config); var temp = jQuery.extend(true, {}, config);
if (newType == "stackedBar"){
temp.type = "bar";
temp.options.scales.xAxes = [{ "stacked": true }];
temp.options.scales.yAxes = [{ "stacked": true }];
}else{
temp.type = newType; temp.type = newType;
if (newType == 'radar' || newType == 'pie' || newType == 'polarArea' || newType == 'doughnut') { if (newType == 'radar' || newType == 'pie' || newType == 'polarArea' || newType == 'doughnut') {
temp.options.scales.xAxes = { "display": false }; temp.options.scales.xAxes = [{ "display": false, "stacked": false }];
temp.options.scales.yAxes = { "display": false }; temp.options.scales.yAxes = [{ "display": false, "stacked": false }];
}
} }
myChart = new Chart(ctx, temp); myChart = new Chart(ctx, temp);
......
...@@ -65,9 +65,9 @@ ...@@ -65,9 +65,9 @@
</a> </a>
</li> </li>
<li> <li>
<a class="treeview submenu" href="#" onclick="change('bubble')"> <a class="treeview submenu" href="#" onclick="change('stackedBar')">
<i class="fa fa-bar-chart"></i> <i class="fa fa-bar-chart"></i>
<span>Bubble Chart</span> <span>Stacked Bar Chart</span>
<span class="pull-right-container"> <span class="pull-right-container">
<span class="label label-primary pull-right"></span> <span class="label label-primary pull-right"></span>
</span> </span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment