minhyen97
Posts: 30
Joined: Mon Apr 12, 2021 10:50 am
Location: PM

Add volume data on chart Real time

Hello,
I'm creating a candlestick and volume chart Real time:
https://jsfiddle.net/minhyen97/ugLckt0z/11/

Code: Select all

 series.addPoint(dataPush, true, true);

Code: Select all

series: [{
            type: 'candlestick',
            name: 'Random data',
            data: data
        },
        {
            type: 'column',
            name: 'Volume',
            data: volume,
            yAxis: 1
        }
            
        ]
Currently there is a problem that I don't add volume with series.addPoint (dataPush, true, true);
Can you help me. Thank you very much!
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: Add volume data on chart Real time

Hello, welcome to the official highcharts forum, and thanks for contacting us with your question!
I used your demo, and used the addPoint method on volume series and everything seems to be in order. Check the following demo: https://jsfiddle.net/BlackLabel/xfc8ksL9/

and let me know if that works for you! In case of any further questions feel free to contact us again! Kind regards,
Paweł Lysy
Highcharts Developer
minhyen97
Posts: 30
Joined: Mon Apr 12, 2021 10:50 am
Location: PM

Re: Add volume data on chart Real time

Thank you so much!
Can you help me with one more problem. That is to change the default body color and tone. Currently, if the data is high, it will be green and the low data will turn red. I have consulted the documentation but have not found a solution yet. Hope you will respond soon.
Thank you!
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: Add volume data on chart Real time

Paweł Lysy
Highcharts Developer
minhyen97
Posts: 30
Joined: Mon Apr 12, 2021 10:50 am
Location: PM

Re: Add volume data on chart Real time

Thank you very much pawelys!
But for now I want to change the candle's color based on the open and close data on entry. If open is larger, it will be green while the opposite is red (The time is white and blue). But I don't know how to write conditional in this code. Because I have only recently researched this library but I find this library very good. So can you help me with this problem.
One more time thank you very much!
Demo : https://jsfiddle.net/r2yfx6pc/4/
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: Add volume data on chart Real time

Hello again! We are preparing such a series type, but at the moment you would have to add the color property to each point. You can do it as I did in this demo: https://jsfiddle.net/BlackLabel/ao8pbx94/

You can define the point value as an object as well (not only an array of values), in which you can set all of the options, that are available here:https://api.highcharts.com/highstock/se ... stick.data

Let me know, if that works for you! Kind regards,
Paweł Lysy
Highcharts Developer
minhyen97
Posts: 30
Joined: Mon Apr 12, 2021 10:50 am
Location: PM

Re: Add volume data on chart Real time

Thank you so much!.
The program I was running.
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: Add volume data on chart Real time

good to hear! In case of any further questions feel free to contact us again! Kind regards,
Paweł Lysy
Highcharts Developer

Return to “Highcharts Stock”