我正在使用chart.js并使用圆环图。我将服务器端(coldfusion)变量传递给javascript,希望在我的图表中使用它。
var <cfoutput>#ToScript(pieAmount, "generated_key")#;</cfoutput>
var sharePiePolorDoughnutData = [
{
value: generated_key,
color: "#455C73",
highlight: "#34495E",
label: "Dark Grey"
},
{
value: 50,
color: "#9B59B6",
highlight: "#B370CF",
label: "Purple Color"
},
{
value: 150,
color: "#BDC3C7",
highlight: "#CFD4D8",
label: "Gray Color"
},
{
value: 180,
color: "#26B99A",
highlight: "#36CAAB",
label: "Green Color"
},
{
value: 100,
color: "#3498DB",
highlight: "#49A9EA",
label: "Blue Color"
}
];
在检查元素时,name:value对的值只是读取javascript变量,而不是变量的值。
如何获取要在数据结构中读取的变量的值?
谢谢!