我有以下代码:
<script>
var target = <%= @main.sum(&:target) %>;
var forecast = <%= @main.sum(&:forecast) %>;
var achieved = <%= @main.sum(&:achieved) %>;
var pieData = [
{
value: target,
color:"#ed1c24"
},
{
value : achieved,
color : "#000"
}
];
var opt = {
scaleFontFamily : "'Trebuchet'",
segmentStrokeColor : "#fff",
}
我需要查看饼图上实现了多少目标。代码有效,我只需要一种achieved
从target
图中减去数字的方法