我的应用程序中的情节图表的js,但它没有使用正确的颜色,我在这里粘贴一个jsfiddle,看看是否有人可以看到错误,(我的问题是两个部分具有相同的颜色,即使我指定它不同,当我将“两个”部分悬停时,三个也突出显示)
var c = document.getElementById('mcanvas');
var ctx = c.getContext("2d");
var data = [
{"value":1,"label":"One","color":"#6e2a89","highlight":"#f00"},{"value":1,"label":"Two","color":"#b26b65","highlight":"#f00"},{"value":3,"label":"Three","color":"#f42be","highlight":"#f00"},{"value":1,"label":"Four","color":"#57b893","highlight":"#f00"},{"value":7,"label":"Five","color":"#4b8752","highlight":"#f00"},{"value":0,"label":"Six","color":"#ff7e9","highlight":"#f00"}];
var ch = new Chart(ctx).Pie(data, {});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
<canvas id="mcanvas"></canvas>
答案 0 :(得分:2)
三个人的颜色是5位数。不确定为什么这会导致这种行为。但修复它将解决您的问题。