Charts Mobile onClick

Charts Mobile onClick

  

Hello All,

I am working on a mobile app and I am using the column charts. I want to use the OnClick event which is new in ChartsMobile. I need the datetime which is in the label of the selected datapoint. But instead of a datetime it returns a date. I have debugged this problem and this is the Javascript where it goes wrong: 

if ($parameters.this.series.chart.xAxis[0].isDatetimeAxis) {
    var date = new Date($parameters.this.category);
    $parameters.label = date.getFullYear() + '-' + ((date.getMonth()+1) < 10 ? '0' : '') + (date.getMonth()+1) + '-' + (date.getUTCDate() < 10 ? '0' : '') +date.getUTCDate();
}

This seems to be a problem in the ChartsMobile component. Is there anything I can do right now to work around this?

Best regards,
Aart van Bitterswijk

Hi Aart,

Nice catch. Unfortunately, the ChartsMobile component is a bit of a mess in places (I've ran into various serious problems in the past). I think the only way to "work around" the bug is to patch the JavaScript.

Solution

Kilian Hekhuis wrote:

Hi Aart,

Nice catch. Unfortunately, the ChartsMobile component is a bit of a mess in places (I've ran into various serious problems in the past). I think the only way to "work around" the bug is to patch the JavaScript.

Hey Kilian,


I worked around it now by setting the data type as text and adding unix datetimestamps to the labels. I translate the Unix datetimestamp in the label formatter. This way I control how the data is displayed and saved. I do hope Outsystems will improve the ChartsMobile component in the future.


Solution

Hi Aart,

Great to hear you've found a workaround, and I share the sentiment about the component :).