Reputation: 185
I'm finding difficulties in overcoming the issue with moment()
in latest version 1.8 within apex class. Previously, I had version 1.6 which was working without any issues. Had the below error message in console:
Uncaught ReferenceError: moment is not defined
I have included the latest zoomchart.js
file in my code. Any solution?
Upvotes: -1
Views: 1081
Reputation: 21495
The reason is that you are using moment()
in your own code. For that to work you have to include moment.js
reference as well.
ZoomCharts wraps the included moment code in an internal namespace so it can use it itself but your own code has to use a manually included version. This is done because the moment code bundled has been modified and thus might not conform to moment.js documentation.
Upvotes: 1
Reputation: 4977
It works fine with 1.8. Have a look at this JSFiddle example:
var t = new TimeChart({
container: document.getElementById("demo"),
area: { height: 350 },
data: {
preloaded: {
values: [
[0, 100],
[1000, 200],
[2000, 300],
[3000, 400],
[4000, 500]
],
unit: 's'
},
timestampInSeconds: true
}
});
https://jsfiddle.net/2fguq058/
It must be your local code/modifications that are breaking your app. Please share more details.
Upvotes: 0
Reputation: 185
The Problem is, in latest version of Zoom charts (version 1.8) they have removed the supported files of moment.js where in v1.6 they have given by default. So, whoever install latest version of zoom charts must include an another file for moment.js. Reference link: http://momentjs.com/
URL of downloadable file: http://momentjs.com/downloads/moment.min.js
Hope it helps.
Upvotes: -1