|
yAxis2 not sync with yAxis |
| Posted by icm63 on Jun-18-2025 04:19 |
|
v 6.0, vb.net
see chart attached ... Finance chart with an added XYChart added underneath main finance chart.
Right hand axis
yAxis.setlogscale()
Left hand axis
yAxis2.setlogscale()
NOTE: y Axis values changed with this code
If MaxHighLow >= 90000 Then
DrawLayer.yAxis2().setMultiFormat(Chart.RegularSpacingFilter(1, 0), "{={value}/1000|0}k")
Else
DrawLayer.yAxis2().setLabelFormat("{value}")
End If
Yet the drawing of the axis is different, the left shows 500k, where as the right does not only 200k (Bitcoin data).
Q; How can I ensure y axis label values line up on upper level amounts in setlogscale() mode?
I do not want to sync them I just want to ensure the chart drawing area is the same for both left and right yAxis.
|
Re: yAxis2 not sync with yAxis |
| Posted by Peter Kwan on Jun-18-2025 13:23 |
|
Hi icm63,,
In a FinanceChart, the top of the plot area is occupied by the legend. Therefore the right axis scale does not reach the top of the plot area. This can avoid the chart content from overlapping with the legend. This can also avoid the top label from overlapping with the bottom label of the chart above it.
I have attached a FinanceChart example. Note the grey bar at the top of the plot area, which is the legend. None of the right y-axis extend to the top of the plot area.
For your case, I am not sure how your chart is configured. You may have somehow disable or hide the legend box. In any case, to ensure both the left and right y-axis are similar, you can configure them with the same length and same top margin. For the FinanceChart, the right y-axis top margin and be configured with FinanceChart.setYAxisStyle. See:
https://www.advsofteng.com/doc/cdnet.htm#FinanceChart.setYAxisStyle.htm
For an XYChart, the API is Axis.setMargin. See:
https://www.advsofteng.com/doc/cdnet.htm#Axis.setMargin.htm
Best Regards
Peter Kwan
|
Re: yAxis2 not sync with yAxis |
| Posted by icm63 on Jun-18-2025 14:38 |
|
| So how do I ensure the margins used for yAxis (right hand side), can be the same for yAxis2 (left hand side) in the finance chart? |
Re: yAxis2 not sync with yAxis |
| Posted by icm63 on Jun-18-2025 14:59 |
|
got it sorted with .setMargins
thx |
|