Home › forums › Using CanvasJS › combining candlestick chart and line chart (moving average line)
Tagged: candlestick chart
This topic contains 32 replies, has 4 voices, and was last updated by Vineet Deodhar 1 year, 4 months ago.
For a dataset, you can have only one Simple Moving Average. Calculating SMA over again will give you the same set of SMA and plotting it will lead to overlapping of two SMA’s. Also, you can refer this wiki on SMA for more info.
Can’t we have two dataset and two moving average for each data? I need two lines for two different data but I dont know how to get data for that line?
Please have a look at this jsfiddle.
Thank you so much.
How can we display exact decimal in Moving Average Calculation. Currently it is showing either .50 or 1. How can I show exact calculation like 1.82 if my calculation is 1.82 in moving average label.
Also, How can I set left hand side point starting 0, 0.2, 0.4,0.6,0.8,1.0,1.2 etc. Normally it comes automatically but is there way to set it by code.
How can we display exact decimal in Moving Average Calculation. Currently it is showing either .50 or 1. How can I show exact calculation like 1.82 if my calculation is 1.82 in moving average Tool Tip.
Also, How can I set left hand side Label point starting 0, 0.2, 0.4,0.6,0.8,1.0,1.2 etc. Normally it comes automatically but is there way to set it by code.
Please take a look at yValueFormatString for formatting y-values in the toolTip. Also, kindly refer axisX.minimum for setting a minimum value and axisX.interval for customizing the interval at which the axis labels are shown.
In this candlestick chart, How do I change the colours of candles (e.g. blue for up-candles, red for down candles).
You can set the color, risingColor, and fallingColor to change the color in Candlestick Chart as per your requirement.
I could set the risingColor now.
1) Regarding fallingColor, the documentation says that “fallingColor property can only be used with waterfall chart.”.
Is there any workaround for this?
2) How do I set the border color for candles? I searched the docs, but could not find it. So request you for help.
In case of Candlestick Chart, fallingColor can be used to override the default color of those dataPoints whose values are less than the previous dataPoint.
In Candlestick Chart, you can use color to set the default color of the dataPoint and the border of the dataPoint as well.
I have tried as you advised.
Now Up-candle and down-candle colors are done.
The only issue remaining is border color of candlestick.
Pl. refer to this jsfiddle.
Since I have specified color: “red”(to get down-candle color), down-candle as well as border color have now become red.
Any suggestion on this (to get rid of border-color)?
Assigning color to every dataPoints based on the risingColor or fallingColor will work fine in your case. Please take a look at the method changeBorderColor(chart) in this updated jsfiddle.
That’s what I required.
Suggestion:- You may think of including this “changeBorderColor” function into the library of canvasjs so that others can also get benefited.
I really appreciate your service support quality.
You surpass my expectation levels.
Pl. keep it up and wish you and your team all the best.
Thanks for the appreciation. We will reconsider the behavior in future releases.
You must be logged in to reply to this topic.