B4J Library [B4X] [XUI] xChart Class and b4xlib

Alessandro71

Well-Known Member
Licensed User
Longtime User


i don't really get your equivalency between axis label and scale unit.
As a sample, I really mean moving the "battery temperature" text on the other side, leaving "power" on the right.
Just to explain better my idea...
 
Last edited:

Blueforcer

Well-Known Member
Licensed User
Longtime User
it seems the lib wasnt updated, still get 8.1. Also online version in IDE shows 8.1.
Where i get the 8.3 please?
 

klaus

Expert
Licensed User
Longtime User
The xChart library has been updated to Version 8.3

Version 8.3
Added CANDLE chart
Version 8.2
Added the YAxisName2 property, a second Y axis name for different scales

CANDLE chart

 

Peter Simpson

Expert
Licensed User
Longtime User
Thank you for the update @klaus
The xChart library has been updated to Version 8.3
View attachment 127223

I've always wanted to ask you to add a candle chart, but felt a bit cheeky doing so.
I have my own bespoke stock app for my options and thus prefer to view movements via candle charts. Once again thank you for updating this already awesome xChart library.

Just like a good wine, xChart gets better with age.

Cheers
 

Peter Simpson

Expert
Licensed User
Longtime User
Hello @klaus
Great work as usual, you're the man .

I just quickly tested your new chart using the example test app that I posted on the forum, It only took me about 5 minutes to implement into that test app and it works and matches Yahoo Finance candle chart perfectly.

Comparing M$ Corp candle chart against Yahoo Finance, it matches perfect
Simple B4X test app


Yahoo Finance


I was just wondering would you be willing to add 'TickWidth As Int' after 'ShowTick As Boolean'. I personally think that the tick is too thick and stands out too much especially when using the default blue color or set to black, but that's just my personal opinion.



Thank you...
 

klaus

Expert
Licensed User
Longtime User
If I understand you well, with ticks you mean what is called the shadow in the image below:



Currently it is calculated.
1dip for bar width < 5dip
2dip for bar width < 10dip
3dip for bar width >= 10dip

I can either add a property or set the max width to 2dip.
 

Peter Simpson

Expert
Licensed User
Longtime User
I can either add a property or set the max width to 2dip.
Hello @klaus,
Yes the upper/lower shadow, they are also called Wicks and also Tails but that depends on who you are talking to at the time. I personally call them Wicks so thinking about it 'WickWidth As Int' or 'TailWidth As Int' would probably be a better name for for the property be better.

I think adding a property would be a the more desirable solution, I believe that it gives developers more options. Maybe setting the width to 0dp could leave it the way that it currently is (auto), and setting the dp>0 manually will override the auto width.

There are other candle stick patterns for the body being filled in or not automatically. For example if the closing price is higher or lower than the opening price. Klaus I really like the simplicity of coding this chart, well I say coding I just changed the chart typed and read the data to create the chart, it look 5 minutes once I saw your example, easy

By the way 'CANDLE' is missing from the possible values list


Thank you

Peter
 
Last edited:

klaus

Expert
Licensed User
Longtime User
I called these lines shadow because this is what I saw in wikipedia.
I have changed the name to Wick.
Setting a default value of 0 is, for me, not a choice as these lines do exist.
With a width of 0 the high and low values would not appear.

I have added a property with a default value of 2dip, and the user can change it.

The class has been updated to version 8.4 in the first post.
 

Peter Simpson

Expert
Licensed User
Longtime User
The class has been updated to version 8.4 in the first post.

WOW what's fast work Klaus, thank you very much.
I've just tested 8.4 and

Thank you.



Mainly Upper/lower Wick/Tail sometimes also know as Upper/lower Shadow, all the same thing though so thank you again. Tomorrow I'll update the forum tutorial that I released but using both Line or Candle charts via conditions.

Perfectamundo
 

Mahares

Expert
Licensed User
Longtime User
I have added a property with a default value of 2dip, and the user can change it.
1. Changing the Wick width to 7 or any other number does not seem to make a difference for me. Is that on my end.
2. When you click on a bar, the red selection vertical bar hides the high and low readings unless you look at the data. How to avoid smothering the high/Low.
3. And this one, very minor and insignficant, does not warrant any action: The intellisense typo: Heigh should be High.
 

klaus

Expert
Licensed User
Longtime User
Thank you for reporting !
1. Was already amended in the last update. Download the xChart.b4xlib or xChart.bas file from the first post.
2. Set, in the Designer, the KeepDisplayValues property to NONE. Is amended for the next update.
3. Amended for the next update.
 

Blueforcer

Well-Known Member
Licensed User
Longtime User
Does the library provides a Pinch2Zoom function for a lineChart?
That would be awesome
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…