Forum Stats

  • 3,824,769 Users
  • 2,260,416 Discussions
  • 7,896,309 Comments

Discussions

Scatter chart with date axis

user-skyworker_4418598
user-skyworker_4418598 Member Posts: 351 Bronze Badge
edited May 1, 2020 9:08AM in APEX Discussions

Is there a way or a workaround to get date labels into the x-axis on a scatter chart? I searched for "scatter chart dates" for the past year and there was virtually nothing. Thanks for any help.

Bill

Oleh Tyshchenkouser-skyworker_4418598

Best Answer

«1

Answers

  • Oleh Tyshchenko
    Oleh Tyshchenko Member Posts: 716 Gold Trophy
    edited Apr 28, 2020 2:44AM

    Try to use, for example, epoch or YYYYMMDD format for your dates and then convert them to strings using a custom axis label converter. See APEX 20.1 Sample Charts applications page 46 Event Drops to see how to add a custom converter.

    user-skyworker_4418598
  • Hilary Farrell-Oracle
    Hilary Farrell-Oracle Software Development Senior Manager Member Posts: 2,346 Employee
    edited Apr 28, 2020 5:51AM

    Hi Bill,

    A Scatter chart does not support defining Datetime information on the x-axis.  Both x and y axes expect numeric values, to view relationships between the two values.

    Oleh's suggestion of rendering an Event Drops visualisation, which is essentially a customised Line chart, may suit your requirements.  Alternatively, just go with the declarative option of defining a Line chart based on a Datetime x-axis, and set the following series-level attributes, to only display markers and no lines:

    line_chart_wo_lines.png

    Regards,

    Hilary

    Oleh Tyshchenkouser-skyworker_4418598
  • user-skyworker_4418598
    user-skyworker_4418598 Member Posts: 351 Bronze Badge
    edited Apr 28, 2020 9:28AM

    Thanks Hilary and Oleh. I will try these options and report my results.

    Bill

  • user-skyworker_4418598
    user-skyworker_4418598 Member Posts: 351 Bronze Badge
    edited Apr 28, 2020 1:58PM

    Hilary,

    I think I am out of luck. My use case involves timelines on both axes (the red line is when the x-axis date-time and y-axis date-time are equal). The blue and green lines represent the start and end of a scheduled activity, and the y-axis represents the date and time the activity was scheduled. So most of the activities depicted started at the same time they were scheduled, i.e. immediately.

    My workaround, as you see, is to show the number of days since the "From Date" on both axes. Not pretty but still workable.

    Maybe something for the "would be nice one day" list (which I am sure is very large). Thanks very much.

    Bill

    pastedImage_0.png

  • Oleh Tyshchenko
    Oleh Tyshchenko Member Posts: 716 Gold Trophy
    edited Apr 28, 2020 2:48PM

    I believe all this "days since" can be turned to a "dates" with a custom converter but are you sure you really need a scatter chart? Because what you are showing looks more like a gantt one.

  • user-skyworker_4418598
    user-skyworker_4418598 Member Posts: 351 Bronze Badge
    edited Apr 28, 2020 3:06PM

    Yes, it's like a Gannt chart except the y-axis is also a date-time. I don't think that is an option in a Gannt chart.

    I acknowledge that this is not a common chart!

    Bill

  • Oleh Tyshchenko
    Oleh Tyshchenko Member Posts: 716 Gold Trophy
    edited Apr 28, 2020 4:26PM

    So maybe there is no need in y-axis at all. Just create a gantt chart with one row (i.e. SAA activation) with multiple tasks in it.

  • user-skyworker_4418598
    user-skyworker_4418598 Member Posts: 351 Bronze Badge
    edited Apr 28, 2020 5:51PM

    I wish. This is a custom presentation that reveals or illustrates the scheduling of a resource in two dimensions, both in terms of the start and end date (and time) and in terms of when it was scheduled. That last element is important information that would be lost if there was only one row. This reflects a live operation and users who are scheduling the resource in real time.

    Not sure how else to explain it. I think the correct answer is it can't be done in Jet.

    Bill

  • Oleh Tyshchenko
    Oleh Tyshchenko Member Posts: 716 Gold Trophy
    edited Apr 29, 2020 2:31AM Answer ✓

    Create a custom renderer and turn all your "days since" labels first to javascript dates and then to strings of the required format.

  • user-skyworker_4418598
    user-skyworker_4418598 Member Posts: 351 Bronze Badge
    edited Apr 29, 2020 4:49PM

    That sounds right but can you give me more detail? I think you're talking about writing some javascript in the Javacript Initialization Code field in the attributes panel of the chart region, correct? Could you give me some sample code? I would really appreciate it.