Solved

drawing a time series diagram

Posted on 2013-12-16
7
167 Views
Last Modified: 2014-01-08
I want to draw a time series diagram On the X-axis ,I want to mark out months like this:

2012-1     (January 2012)
2012-2     ....
2012-3
2012-4
2012-5
2012-6
...

Could someone give a sample expressions that achieves this?
0
Comment
Question by:mdoland
  • 4
  • 3
7 Comments
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39721335
Hi,
could you please explain what you mean with
a sample expressions that achieves this
?

What charting library are you using?
Do you have already some sort of script and HTML code?

THanks.
Rainer
0
 

Author Comment

by:mdoland
ID: 39721364
I use Flot. I dont have any html.
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 39721603
Hi,

I have provided a simple sample here:
http://jsfiddle.net/EE_RainerJ/vFTYA/

To display the month names, you have to configure/set the x-axis options like
        xaxis: { 
                 mode: "time",
                 timeformat: "%y-%m",
                 tickSize: [1, "month"],
                 min: (new Date(2011, 12, 1)).getTime(), 
                 max: (new Date(2013, 2, 1)).getTime()
        }

Open in new window


HTH
Rainer
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:mdoland
ID: 39723834
Excellent!

One more related question ... with %y I am supposed to get the full year ... 4 digits. On the jsfiddle I do get all 4 digits, however not in my application. What could cause that? I only get the 2 last digits. I use the same browser so it can't be that.
0
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39723941
Hm,
could depend on the data - perhaps its not correctly interpreted as dates / datetimes.

Could you provide your data array?

HTH
Rainer
0
 

Author Comment

by:mdoland
ID: 39725994
Here it is:
	    serie1 = [[new Date(2002,1,1), 0.39], [new Date(2003,1,1), 0.27], [new Date(2004,1,1), 0.60],[new Date(2005,1,1), 0.75],[new Date(2006,1,1), 0.61],
	              [new Date(2007,1,1), 0.22],[new Date(2008,1,1), 0.1],[new Date(2009,1,1), 0.4],[new Date(2010,1,1), 0.15],[new Date(2011,1,1), 0.22],
	              [new Date(2012,1,1), 0.36],[new Date(2013,1,1), 0.10]];
	    serie2 = [[new Date(2002,1,1), 0.29], [new Date(2003,1,1), 0.22], [new Date(2004,1,1), 0.20],[new Date(2005,1,1), 0.75],[new Date(2006,1,1), 0.22],
	              [new Date(2007,1,1), 0.22],[new Date(2008,1,1), 0.5],[new Date(2009,1,1), 0.4],[new Date(2010,1,1), 0.22],[new Date(2011,1,1), 0.11],
	              [new Date(2012,1,1), 0.34],[new Date(2013,1,1), 0.22]];

Open in new window

0
 

Author Comment

by:mdoland
ID: 39725999
It seems to show up correctly when I put it in you fiddle code.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now