Home Forums Chart Support axisX label set

axisX label set

Viewing 5 posts - 1 through 5 (of 5 total)
  • #11736

    Hi,

    I want to set the X’s label as a string of an Array, and this array is like:
    [2016-07-25, 2016-07-26, 2016-08-01, 2016-08-02, 2016-08-03, 2016-08-04, 2016-08-05, 2016-08-08, 2016-08-09, 2016-08-10]
    so I write the dataPoints:

    but the result shows:

    only the X axis is totally wrong, but I’m pretty sure that the array data is right,
    So can you help me out? Thanks!

    #11737

    Ernest,

    We observe that the array you are passing for labels are numbers and not string. If you like to display it as 2016-08-04 in label, store it as a string(“2016-08-04”). As its not a string, its considered as number and the result of 2016-08-04(2004) as been considered and assigned to label.

    Change the array to [“2016-07-25”, “2016-07-26”, “2016-08-01”, “2016-08-02”, “2016-08-03”, “2016-08-04”, “2016-08-05”, “2016-08-08”, “2016-08-09”, “2016-08-10”]. And it works fine.

    #11738

    Vishwas R,

    I’ve tried that way to fix it, but the result is:

    it just add “” to the wrong “numeric” X label.
    So, what can I do to let the system consider it as an String?

    Or if the definition is wrong at the very beginning?
    Here’s my definition code:

    it’s a jsp page and al4() is an ArrayList<String> type of Java, it stores bunch of date String:
    2016-08-04, 2016-08-05, 2016-08-08, 2016-08-09, 2016-08-10..
    with the combination code I pass the Java ArrayList item to the JavaScript Array item
    So can you give me some advise to fix it?
    Thank you!

    #11739

    Ernest,

    It seems that the ArrayList you are storing is not string and result (2016-08-04 = 2004) is calculated at that instance and stored. Storing string within the array-list would solve the issue.

    If your arraylist looks like al4 = [2016-07-25, 2016-07-26, 2016-08-01, 2016-08-02, 2016-08-03, 2016-08-04, 2016-08-05, 2016-08-08, 2016-08-09, 2016-08-10]; changing it to al4 = ["2016-07-25", "2016-07-26", "2016-08-01", "2016-08-02", "2016-08-03", "2016-08-04", "2016-08-05", "2016-08-08", "2016-08-09", "2016-08-10"]; would solve the issue.

    #11740

    Hi,

    It worked!
    With ur method, I checked my array. And I did store the String type to the ArrayList() al4, but when it pass to the JavaScript by using the method “out.print()”, it’ll get rid off the ” ” characters, so it should be like this ” out.print(“\””+al4.get(i)+”\””)”, then the “2016-xx-xx” will stored in the array of JavaScript.

    Thanks for ur time!!!!!! :)

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.