Chart.js 图例位置错误

Chr*_*ris 1 javascript charts typescript chart.js chart.js2

我尝试将饼图的图例(使用 Chart.js 2.0 创建)向左或向右移动,但总是出现错误。底部和顶部选项有效。

var myChart = new Chart(ctx, {
        type: 'pie',
        data: {
            labels: optionLabels,
            datasets: [{
                label: '# of Resources',
                data: optionData,
                backgroundColor: optionColor,
                borderColor: "white",
                borderWidth: 1,

            }]
        },
        options: {
            legend: {
                position: 'left'
            }
        }
    });
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

是否存在库错误或类似问题?

ɢʀᴜ*_*ᴜɴᴛ 5

似乎您正在使用旧版本的 ChartJS (可能有此错误)

确保您使用2.7.0当前最新版本的 ChartJS。

请参阅一个工作示例