Jump to content
JChartFX Community
  • 0

Axis Section for X-Axis




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");



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

  • 0

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.


Link to comment
Share on other sites

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.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...