Android Question Problem with Right axis labels on mpChart v1.01 MultiLine Chart

beaker

Member
Licensed User
This is my first post here so I'll just say a quick 'Hi' to everyone.
I've only been using B4A for a few weeks so I'm still a bit of a newbie. Anyway, onto the issue at hand:

I'm using mpChart v1.01 with B4A 5.80 and I'm having a problem with the right side Y axis labels on a multiline chart. However the issue appears or disappears depending on the left hand Y axis values. I've stripped out most of the code from my app which isn't relevent and attached the zipped up project as well as a couple of screenshots showing the issue. The first screenshot looks as I'd expect but the second one looks as though the right hand Y axis values have been rounded to the nearest integer.

To explain the charts: There are five sets of data on each chart, 4 of them are tied to the left hand Y axis and the fifth (cyan dashed) is tied to the right hand Y axis. The only difference between the two sets of data is in the values behind the lines tied to the left hand Y axis, the data behind the right side Y axis is the same in both cases. You'll see that the right Y axis values shown are: 0.00, 0.60, 1.20, 1.80, 2.40, 3.00 in the first screenshot and 0, 1, 1, 2, 2, 3 in the second screenshot.

Am I missing something or shouldn't the label values be as per the first screenshot?

Any help would be greatly appreciated.

Marcus

Chart1.png
Chart2.png
 

Attachments

  • MLC Right Y Axis Labels Issue.zip
    35.9 KB · Views: 344

mc73

Well-Known Member
Licensed User
Longtime User
I think that this is caused by setting intDecimal to 0 in the second chart. Never used this lib though, so perhaps it's something else.
 
Upvote 0

beaker

Member
Licensed User
Hi mc73
Thanks for your reply. intDecimal is only used for the four lines bound to the left Y axis. The number of decimals is set to 2 for the right Y axis in both charts in line 137:

chrtChart.GraphValueDigits = Array As Int(intDecimals, intDecimals, intDecimals, intDecimals, 2)
 
Upvote 0

beaker

Member
Licensed User
I've now stripped out any reference to intDecimals and set them all to a constant value of 2 but it hasn't made any difference whatsoever to the right axis Y labels.

Is there a better charting library out there? Anyone else got any ideas apart from putting two seperate charts in my app (which I don't really want to do)?

Thanks.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I played with your project. The reason your right Y axis values do not show the decimals when plotting data from table: readings2 is the disparity between the values in all 5 columns. In table readings1 all columns plotted have numbers that range from 0 to 7, but in table Readings2, the 4 columns for the left Y axis range from 0 to 300 or so, but the column plotted in the right Y axis has values that range from 0 to 3 or so, which skews the scaling. Either make this line all plotted with respect to left Y axis like below or wait for @Johan Schoeman to take a look. He loves challenges.
B4X:
Dim ad() As String = Array As String("LEFT", "LEFT", "LEFT", "LEFT", "LEFT")
I saw that you also posted in Johan's lib thread. I am sure he will see it and respond.
 
Upvote 0

beaker

Member
Licensed User
Thanks for taking a look.
Yes exactly. That's the only difference between the two (the data values for the left-hand side). This shouldn't affect the right hand side Y axis as this is to all intents and purposes a seperate chart. The reason why I need it to work for both sets of data is that my app needs to cater for two different units used throughout the world. Here in the UK we use one unit and in just about every other country (as far as I know) they use a different unit. The normal values in the UK are around the 0-10 range but the values for the rest of the world are in the 100-300 range or thereabouts. This goes for the left hand values, however the right hand values are unitless and are in the 0 to 4ish range wherever you are.

In the initial development stages of my app it only catered for UK units so all charts were referenced to the left Y axis. This worked great. It was only when I had to 'internationalise' it that I had to add the right Y axis dependency for that one line.

Anyway, as you noticed, I've posted in the mpChart Library thread so I think any further discussion should probably go on over there.

Hopefully Johan will have the time to take a look at it for me.

Thanks again for taking a look and for your input.
 
Upvote 0
Top