Time Line graph is not showing date exactly - javascript

I am working on time line graph i am getting From date and To date from date base. I am binding that values to time line graph through javascript. But Graph is displaying one month ahead.
Ex: My date is 12-jun-2011, but in graph I am getting near 12-july-2011.
How can I solve this ?

Related

Having trouble displaying a date X axis, How do I get all dates, not just where data points are plotted?

I have a chart to display values across time, but there aren't data points for each day. The chart is just displaying dates on the X axis where data points exist. I want each date to have a vertical line, and the day displayed below for every day in the range (unless overlapping).
I'm using chart.ja version 4.2.1
Extra Points :-)
I would also know how to keep the dates from overlapping when a large range (lots of dates) is being plotted.
Lastly, is it possible to display the dates on three lines, where the top line is the day, the second line shows the month name (once) in the middle of the month, and the third line shows the year in the middle of the year.

Date Fields At Highstock

I have a highstock with multiple series. While plotting, the dates at the top are getting selected as below,
Start date : First series first date value
End Date : Last series last date value
But when i try to change the end date, by default it is getting adjusted as first series first value and last value as start and end date.
I tried setting the extremes but it didnt worked

nvd3 some xAxis ticks missing

I have an nvd3 line chart that needs to display every date in a month on the x axis. For the current month (July) I have generated 31 x,y pairs. However, the chart omits a couple of those data points. Most data points, actually, have the y coordinate set to null (because not all dates have data, but I still need to display every date).
This is how it looks now:
As you can see, there are some dates missing: 07/08/2018, 07/15/2018, 07/22/2018, 07/30/2018 and 07/31/2018.
This is my code:
chart.xAxis.ticks(weightData.length); // this is 31
chart.xAxis.rotateLabels(-35);
chart.xAxis.showMaxMin(false); // if this is true, even less data is displayed
Is there a way to force the chart do display all the data on the x axis?
I have found the answer here:
NVD3 Line Chart X Axis Ticks Are Missing
The point is to use tickValues() instead of ticks() as the answer on the post in link says.

remove time from dates when shown on highchart

how can i remove the time from the date when shown on the highchart.the data (dates) are received from a twitter get request and saved into an array.
for (var i in array) {
dateArray.push(array[i].date);
}
highchart(dateArray);
an example of date shown on the graph: Sat,04 Aug 2012 19:35:02 +0000
The way I see it you have two options:
Only pass in the day value of the time for your categories. Involves processing on the backend.
Pull your data as-is and convert to Javascript time format, make your xAxis datetime type, set up your tickInterval to be one day, and run your chart.
Without know what your data looks like, what you are plotting on the yAxis, or what your expected outcome is it is really hard to say.
I recommend to go with option #2 because this is time based data.
EDIT: Based on your comments
You can first convert the string to a date object, and then format the date object to your liking using SimpleDateFormat.
SimpleDateFormat format = new SimpleDateFormat("EEE, MMM d yyyy");
String formattedDate = format.format(new Date(array[i].date));
dateArray.push(formattedDate);
You can find various date formats # http://blog.stevenlevithan.com/archives/date-time-format

Highcharts data off by one day

I have a Highchart that I cannot seem to fix. The dates on the xAxis are correct but the dates on the labels are off by one day. No matter what data I pass to my chart it is always off by one day. I have been pulling my hair out trying to figure this out. Any tips would be appreciated.
You can see my code here:
http://jsfiddle.net/brenjt/zxBTG/2/
Just found your question... I think the solution to your problem is to set up the UTC timezone option to false. This will set up the chart timezone to be local and not UTC.
Highcharts.setOptions({
global : {
useUTC : false
}
});
See: http://api.highcharts.com/highcharts#global.useUTC
Well, I added time info to the axis and tooltip see http://jsfiddle.net/gATfu/
It looks like your timestamps are from 10pm but the axis labels are showing 0am ... thats why the points look about one day shifted.
it's because of the timezone. You should convert you date in UTC format with Date.UTC(..). It will work
The global HighCharts option for UTC worked quite good. I cannot yet vote that one up :(
I also figured out that HighCharts moves my bar chart according to the exact time stamp as described by dgw. I.e. a date from the 1st of May can be shown in the near of 30th of April depending on the scaling. That confused me because there were two 30th of April entries and no 1st of May.

Categories

Resources