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
- In Highcharts, zooming a small selection up to the edge, zooms both x and y when zoomtype = x
- Highcharts Highmaps prevent initial zoom effect
- Turning off animation in HighCharts globally
- How to get Node Coordinates Data in Sankey Graph
- HighCharts does not recognize a function of Legend
- Highcharts Legend Title Horizontal Align
- console error when changing line color in a HighCharts scatterplot
- How do I get my highcharts to reduce in size when the window is resized down
- Highcharts: convert string to an object with javascript
- How can I get a data label in my Highcharts Pie Chart that is a font-awesome icon?
- highstock: how to change color in areaspline when series intersect sma
- Highcharts: setSize on each Multiple chart
- How do I use dates from a LinkedHashMap for the x-axis on a Highcharts line graph (using Thymeleaf)?
- Programmatically set rangeSelector in Highcharts
- Why HighChart hangs browser?
- Visualization library suggestions
- Some datalabels do not show on highcharts
- Highcharts - Adding a suffix to a tooltip in a multi-series chart
- Stock Chart - Formatted Tooltip And Prefixes or Suffixes Not Showing
- HighcharteR Tooltip
- Add Series in Highcharts on the basis of user input
- Plot Highchart multiple series line chart using JSON data
- Returning JSON file with cURL to use data in a HighCharts stock chart
- Android highcharts how to enable or disable data labels
- Highcharts Series Margins
- read the json file to output to an highcharts
- HighChart generating table without chart
- Highstock - insert HTML link inside flag tooltip
- GWT Highcharts, Java, and xml UiBinder?
- dashboard-style page with Highcharts graphs