almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

X-Axis chart should only contain dates that have data #695

Closed DivyashreeMS closed 9 years ago

DivyashreeMS commented 9 years ago

Hello and thank you for such a great visualization tool. I was wondering is there a way to display the dates which has data.

to put it in more simpler way i have the data on 20th Feb, 27th Feb and 6th March 2015,so I have to display those dates in the x axis. I have to hide all the other date(21,22,23,..28,1,2,3,4,5).

dateswithdata

Thanks & Regards Divya

josdejong commented 9 years ago

You can hide periods using the hiddenDates option. It's described in the Timeline docs but works for Graph2d too.

Here is an example: http://visjs.org/examples/timeline/29_hiding_times.html

DivyashreeMS commented 9 years ago

HI Josdejong,

Thank you for the reply,

But I am trying to hide from 21st Feb to 26th Feb, and there is a node data on 27th Feb. I am expecting to hide 26th Feb as well, Please let me know how to achieve this. Also same with 05th March.

Adding one more point on this, that I am not supposed to show the Time interval. I hope I am clear with my request.

 hiddenDates: [
                    {start: '2015-02-21', end: '2015-02-26'},
                    {start: '2015-02-28', end: '2015-03-05'} // daily weekly monthly yearly

                ],

nodedata

Thanks Divya

josdejong commented 9 years ago

The hiddenDates excludes the end date, so in that case you can do {start: '2015-02-21', end: '2015-02-27'},.

I'm not sure what you mean with "Adding one more point on this, that I am not supposed to show the Time interval."

DivyashreeMS commented 9 years ago

Thank you Josdejong, the suggested solution is working fine. Please ignore "Adding one more point on this, that I am not supposed to show the Time interval."

But I am facing one more issue, that is the last date 6th March the date is not seen in the x-axis. Please let me know how the display the last date as well.

Highly appreciate your help!!

Thanks Divya

josdejong commented 9 years ago

You mean like the last data point is on the edge of the screen? You can apply a custom start and end date for the window via the configuration options or via setWindow(start, end).