rgraph
我在 asp 中调用 canvas 时遇到问题mvc
。这是我的代码,我添加了所有必需的rgraphs
. 也jquery
归档。并面临错误“ Uncaught TypeError: Cannot read property getContext
of null ”
var key = RGraph.HTML.Key('containerPie', {
colors: ['blue', 'green'],
labels: response.labels,
tableCss: {
//position: 'absolute',
top: '50%',
right: '-80px',
transform: 'translateY(-50%)'
}
});
new RGraph.Pie({
id: 'cvsPie',
data: response.res,
options: {
strokestyle: '#e8e8e8',
variant: 'pie3d',
linewidth: 2,
gutterLeft: 5,
shadowOffsetx: 0,
shadowOffsety: 7,
shadowColor: '#ddd',
shadowBlur: 15,
radius: 40,
tooltips: response.res,
colors: ['blue', 'green']
}
}).draw();
这是我的 div 代码:
<canvas id="cvsPie" width="450" height="300"></canvas>