Android Question [solved] YX-chart with formatted timestamps in x-axis

fredo

Well-Known Member
Licensed User
Longtime User
This is regarding Klaus's "xChart": https://www.b4x.com/android/forum/threads/b4x-xui-xchart-class-and-b4xlib.91830/

I want to create a chart that displays two data series simultaneously.
02-02-2024_17-18-36.png

The problem is the labeling of the X-axis in a YX-chart.

The source data have a timestamp in the format long as X-value.
The X values of the two data series can be different.

In order to achieve the desired result, the X-axis labels must be specified in the format "dd.mm.yyyy".

How can this be done?


Testproject attached
 

Attachments

  • ChartsTest01.zip
    10.9 KB · Views: 110

klaus

Expert
Licensed User
Longtime User
Sorry, but this cannot be done with an YX_Chart.
In YX_Charts, the X axis values are doubles and are treated as numeric values.

It can be made with a LINE chart and MissingDataValues.
You need to use xChart1.AddLineMultiplePoints.
When you have missing data set its value to xChart1.AddLineMultiplePoints.
Attached a modified version of your project.
I used -1 for the MissingDataValue, up to you to set any value you want.
I removed the xChart properties settings to the Designer.

1707033576494.png


On the first time stamp there is no value in the red line, the line begins on the second time stamp.
On the second time stamp there is no value in the other line, no circle drawn at the second time stamp.
 

Attachments

  • ChartsTest03.zip
    58.4 KB · Views: 117
Last edited:
Upvote 0
Top