问题
I've created a firefox addon with:
My manifest includes:
"content_scripts": [
{
"matches": [
"..." ],
"js": [
"moment.js",
"jquery.js",
"chartjs.js",
"main.js"
],
"run_at": "document_end"
}
]
main.js includes:
var myChart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
label: label,
lineTension: 0,
backgroundColor: color,
data: data
}]
},
options: {
scales: {
xAxes: [{
type: "time",
distribution: 'linear',
time: {
unit: "day"
}
}]
}
}
});
This works in my Chrome extension, but when I port it to Firefox addon, it shows a blank chart. Even the jsfiddle works in both: https://jsfiddle.net/a9yzuxjf/1/
I've removed the 'type: "time"' and it renders, but the chart isn't a time series like I want. Could this be something to do with moment.js not loading properly?
来源:https://stackoverflow.com/questions/51011867/moment-js-and-chart-js-not-working-in-firefox-addon-when-type-time-is-specified