yogesh Posted November 18, 2012 Report Share Posted November 18, 2012 Hi, I was trying to add axis section based on x-axis range. Here is my sample code: var items = [{"Date":"Thu 11/15/2012 18:34","Value":5972.0},{"Date":"Thu 11/15/2012 17:38","Value":4196.0},{"Date":"Thu 11/15/2012 16:53","Value":4198.0},{"Date":"Thu 11/15/2012 15:37","Value":4233.0},{"Date":"Thu 11/15/2012 14:38","Value":4401.0},{"Date":"Thu 11/15/2012 13:42","Value":4487.0},{"Date":"Thu 11/15/2012 12:39","Value":4678.0},{"Date":"Thu 11/15/2012 11:41","Value":4939.0}]; . . . var axisSections = chart1.getAxisX().getSections(); var section = new cfx.AxisSection(); section.setFrom("Mon 11/12/2012 00:36"); section.setTo("Sat 11/17/2012 14:30"); section.getGrids().getMajor().setVisible(true); axisSections.add(section); It was not working for AxisX. Although if i use AxisY range, it works fine. Can you please help me how to achieve the same for AxisX. Thanks in Advance!! Quote Link to comment Share on other sites More sharing options...
0 JuanC Posted December 4, 2012 Report Share Posted December 4, 2012 The problem is that AxisSection setFrom and setTo are currently not prepared to handle a string representation of a date. In the next version (which should be released in a couple of days) there will be a new Chart method called dateToDouble that translates a JavaScript date object (not a string) into a numeric value so that you can pass it to AxisSection.setFrom and setTo. In future builds we will try to do this translation automatically but for the short term the dateToDouble helper method should do the trick. JuanC Quote Link to comment Share on other sites More sharing options...
Question
yogesh
Hi,
I was trying to add axis section based on x-axis range. Here is my sample code:
var items = [{"Date":"Thu 11/15/2012 18:34","Value":5972.0},{"Date":"Thu 11/15/2012 17:38","Value":4196.0},{"Date":"Thu 11/15/2012 16:53","Value":4198.0},{"Date":"Thu 11/15/2012 15:37","Value":4233.0},{"Date":"Thu 11/15/2012 14:38","Value":4401.0},{"Date":"Thu 11/15/2012 13:42","Value":4487.0},{"Date":"Thu 11/15/2012 12:39","Value":4678.0},{"Date":"Thu 11/15/2012 11:41","Value":4939.0}];
. . .
var axisSections = chart1.getAxisX().getSections();
var section = new cfx.AxisSection();
section.setFrom("Mon 11/12/2012 00:36");
section.setTo("Sat 11/17/2012 14:30");
section.getGrids().getMajor().setVisible(true);
axisSections.add(section);
It was not working for AxisX. Although if i use AxisY range, it works fine. Can you please help me how to achieve the same for AxisX.
Thanks in Advance!!
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.