【发布时间】:2021-03-31 11:54:43
【问题描述】:
我正在使用 Angular、Node/Express 和 MySQL 进行全栈开发。我正在尝试在我的角度应用程序中添加一个图表,该图表将根据我的数据库中可用的数据显示。我已经下载了canvasjs 网站上的示例代码。在根据我的需要修改它之前,我尝试运行示例代码并且它抛出了一个错误。
代码如下:
var chart = new CanvasJS.Chart("chartContainer",
{
title:{
text: "Projects by their Status"
},
axisX: {
valueFormatString: "MMMM",
interval: 1,
intervalType: "month"
},
data: [
{
type: "stackedColumn",
legendText: "Completed",
showInLegend: "true",
dataPoints: [
{ x: new Date(2012, 01, 1), y: 71 },
{ x: new Date(2012, 02, 1), y: 55},
{ x: new Date(2012, 03, 1), y: 50 },
{ x: new Date(2012, 04, 1), y: 65 },
{ x: new Date(2012, 05, 1), y: 95 }
]
},
{
type: "stackedColumn",
legendText: "snacks",
showInLegend: "true",
dataPoints: [
{ x: new Date(2012, 01, 1), y: 71 },
{ x: new Date(2012, 02, 1), y: 55},
{ x: new Date(2012, 03, 1), y: 50 },
{ x: new Date(2012, 04, 1), y: 65 },
{ x: new Date(2012, 05, 1), y: 95 }
]
},
{
type: "stackedColumn",
legendText: "Drinks",
showInLegend: "true",
dataPoints: [
{ x: new Date(2012, 01, 1), y: 71 },
{ x: new Date(2012, 02, 1), y: 55},
{ x: new Date(2012, 03, 1), y: 50 },
{ x: new Date(2012, 04, 1), y: 65 },
{ x: new Date(2012, 05, 1), y: 95 }
]
},
{
type: "stackedColumn",
legendText: "dessert",
showInLegend: "true",
dataPoints: [
{ x: new Date(2012, 01, 1), y: 61 },
{ x: new Date(2012, 02, 1), y: 75},
{ x: new Date(2012, 03, 1), y: 80 },
{ x: new Date(2012, 04, 1), y: 85 },
{ x: new Date(2012, 05, 1), y: 105 }
]
},
{
type: "stackedColumn",
legendText: "pick-ups",
showInLegend: "true",
dataPoints: [
{ x: new Date(2012, 01, 1), y: 20 },
{ x: new Date(2012, 02, 1), y: 35},
{ x: new Date(2012, 03, 1), y: 30 },
{ x: new Date(2012, 04, 1), y: 45 },
{ x: new Date(2012, 05, 1), y: 25 }
]
}
]
});
它抛出一个错误:
Octal literals are not allowed in strict mode.
Octal literals are not available when targeting ECMAScript 5 and higher. Use
the syntax '0o5'.
【问题讨论】:
标签: angular canvas angular-fullstack