score:1
Accepted answer
If you can change how it's generated, generate this instead
var usdeur = [
[Date.UTC(2004, 3 - 1, 31), 0],
[Date.UTC(2004, 4 - 1, 1), 0.134879956838416],
[Date.UTC(2004, 4 - 1, 2), 0.471580293538753],
[Date.UTC(2004, 4 - 1, 3), 0.473578515121543],
[Date.UTC(2004, 4 - 1, 4), 0.474577625912938],
];
If you have no way of fixing the generated code, you may be able to put a custom Date.UTC
function in before it's evaluated, and undo this after.
(function () {
var utc = Date.UTC, slice = Array.prototype.slice;
Date.UTC = function () { // method to take `1` based months
var args = slice.apply(arguments);
if (args.length > 2) // fix your months
args[1] -= 1;
return utc.apply(Date, args);
};
Date.UTC.restore = function () { // method to undo changes
Date.UTC = utc;
};
}());
// eval your array
// ...
// restore original behaviour
Date.UTC.restore();
score:1
In general you can subtract month with such expression:
var d = new Date.UTC(2004, 3, 31);
d.setMonth(d.getMonth()-1);
console.log(d); // Minus one month
With array you can do something like this:
for (var i = 0; i < usdeur.length; i++) {
var date = usdeur[i][0];
date.setMonth(date.getMonth()-1);
usdeur[i][0] = date;
}
Source: stackoverflow.com
Related Query
- How to subtract one month from each month in a Date.UTC Array with jQuery
- How to populate a Highcharts axis with string formatted data from a PHP array
- How to get month name from ISO date using moment js
- How to add one more value against at the end of each bar with a legend
- how to make barchart from date 1 until 31 with different value?
- How filter json data with date from datepicker Angular2 app
- Parsing JSON for use with Highcharts using jquery .parseJSON or JSON.parse: how to remove quotes from function calls for formatters?
- How to draw a chart from one array of data and make labels on the chart from another array of data? Highcharts v.4.0.4
- How to prevent highcharts from shortening labels with ellipsis
- Convert from string with milliseconds to date object Javascript
- Populate Highcharts X-Axis With Dates Given a From And To Date
- Create Density Heatmap Chart using Jquery with array of data
- Remove UTC date from Highcharts tooltip
- how to assign date time to highchart with intervals and date start
- How to create a Jquery array object
- How to use drilldown upto level 3 with different charts on each level in highcharts?
- How do I select which columns from my CSV to chart with HighChart?
- Highcharts - How to populate date with Mysql and PHP?
- c# WPF Webbrowser with Highchart, Javascript from external source not working "An error has occurred in the script on this page"
- How can I make a graph with highcharts from csv file?
- Highcharts - How to make a scatter plot with multiple series from HTML table
- How to deal in Highcharts with special characters from CSV file?
- How to use styled from react-emotion with HighchartsReact?
- Highcharts - how to export chart with different scale in one click
- How to suppress items with NULL value from HighCharts legend
- How to display all dates with a given Start Date and End Date even if there is no data?
- How can I update two highcharts with one dropdown menu?
- How to call User Control from one of the Javascript function?
- How to get selected date from highstock?
- How can i add element with attributes to SVG using jquery
More Query from same tag
- Highcharts X-Axis value on top of stacked column
- Highcharts not rendering in jQuery tooltip
- How to change graph colour above and below plotline in Highcharts
- Unable to update the linkLength of networkgraph highchart js
- Highcarts in Laravel
- Highcharts x axis date grouping not working
- Custom hover / tooltip data on highcharts network chart
- Category in x-axis of second chart is not coming properly
- How to load a highchart script within a WebPartZone
- Disables Crosshair for one series of two
- Highcharts pie wrong legend colors
- Charts in HTML using Datatables
- Highcharts scatter chart legend toggle running slow
- Hide the zero values in a Scatter/Column chart in highcharts
- timestamp values showing wrong on xaxis in highcharts its show default 1970-01-18
- Highcharts streamgraph Y Axis Labels
- Hide Treemap labels for smaller nodes in Highcharts
- Categories positions in highcharts
- highcharts export png files
- Render chart only once with multiple events : Highcharts
- Which chart type should display following chart? gauge or column?
- How to use loops for categories in Highcharts
- Symfony2: Highchartsbundle data problems
- Highchart multiple level drilldown click event get drilldown series data
- Animation from point in Highcharts
- exporting highcharts polar chart to PDF with phantomjs
- Series Data in HighChart
- onclick event when part of highcharts funnel is clicked
- highcharts yaxis start on 1 min:1 not working
- Highcharts - how to set custom content in point tooltip (popup) on 3D scatter chart or how to customize point tooltip information?