PieChart disappears on mouse

I am creating a very simple PieChart from the documentation on Chartjs.org. I think that I am not doing anything or adding any extraneous libraries.

var data = [{
  "value": 20,
  "label": "Slice1"
}, {
  "value": 10,
  "label": "Slice2"
}];

var ctx = document.getElementById("myChart").getContext("2d");
var myNewChart = new Chart(ctx).Pie(data);
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
<canvas id="myChart" width="400" height="400"></canvas>
Run codeHide result

Problem: After the pie chart is displayed first, if I pulled out the chart, it will disappear. It seems to be present when tooltips appear when you hover over the mouse, but not on the diagram / pie fragments themselves.

This behavior has been seen in recent Firefox and Chrome browsers.

+1
source share
1 answer

So, in the Chart.js documentation, http://www.chartjs.org/docs/#doughnut-pie-chart-data-structure

For a pie chart, you must pass an array of objects with a value and an optional color property

, . , ( , , ) JavaScript. , mousemove mouseout , ( ), , , mousemove, mouseout.

Chart.js , , , .

, .

, JSON, , , , .

+2

All Articles