Hello!
There is interesting situation when I’m trying to show volumes on charts in my application. On the first screen you can see that on the left side of the image there is height values of volumes (the data is between 2.000.000 and 5.000.000), on the other side are low (they are between 0 and 100.000 in true values and hardcoded in my sample). It looks like correct because of low vaues, but when i’m scrolling screen to the later data (seconds screenshot), it “jumps” and displays with full-size (on image I’m hardcoded values for 3.000.000, so that’s why they are equals).
When data is hardcoded for 3.000.000 I think it should be closer to the preveous “true” values which are on the left side, but they are not.
It looks like the bottom side of the candles extruding them.
What is the reason of this behaviour? How can I correctly display this data?
Thank you!
- Alexey Tsukanov asked 5 years ago
-
Hi Alexey. Can you provide some code which you use to configure chart? It’s hard to tell what is happening without seeing the code. Do you use two yAxes? Do you use AutoRange.Always for them? Thanks in advance.
- You must login to post comments
For renderSurface I’m using GLTextureView
There is a code:
final IAxis yLeftAxis = sciChartBuilder.newNumericAxis()
.withGrowBy(0, 5d)
.withAxisAlignment(AxisAlignment.Left)
.withAutoRangeMode(AutoRange.Always)
.withAxisId("SecondaryAxisId")
.withDrawMajorTicks(false)
.withDrawMinorTicks(false)
.withDrawMajorGridLines(false)
.withDrawMinorGridLines(false)
.withDrawMajorBands(false)
.withDrawMinorTicks(false)
.withVisibility(View.GONE)
.build();
mMountainDataSeries = sciChartBuilder.newXyDataSeries(Date.class, Double.class)
.withSeriesName("Mountain Series")
.build();
mColumnDataSeries = sciChartBuilder.newXyDataSeries(Date.class, Long.class)
.withSeriesName("Column Series")
.build();
mOhlcDataSeries = sciChartBuilder.newOhlcDataSeries(Date.class, Double.class)
.withSeriesName("Candlestick Series")
.build();
mMountainRenderableSeries = sciChartBuilder.newMountainSeries()
.withDataSeries(mMountainDataSeries)
.withYAxisId("PrimaryAxisId")
.withStrokeStyle(0xFF0b1f35)
.withAreaFillLinearGradientColors(0x1A384F7B, 0x000b1f35)
.withIsVisible(false)
.build();
mCandlebarRenderableSeries = sciChartBuilder.newOhlcSeries()
.withDataSeries(mOhlcDataSeries)
.withYAxisId("PrimaryAxisId")
.withIsVisible(false)
.build();
mCandlestickRenderableSeries = sciChartBuilder.newCandlestickSeries()
.withDataSeries(mOhlcDataSeries)
.withYAxisId("PrimaryAxisId")
.withIsVisible(true)
.build();
mColumnRenderableSeries = sciChartBuilder.newColumnSeries()
.withDataSeries(mColumnDataSeries)
.withYAxisId("SecondaryAxisId")
.withDataPointWidth(0.8)
.withPaletteProvider(new ColumnsPaletteProvider(mCandlestickRenderableSeries, mCandlebarRenderableSeries))
.build();
- Alexey Tsukanov answered 5 years ago
-
Well candles shouldn’t affect columns because they are attached to different yAxes ( candles use yAxis with AxisId = ‘PrimaryAxisId’ and columns use yAxis with AxisId = ‘SecondaryAxisId’ ). I believe the behavior which you described could be caused by the fact that you use AutoRange.Always for your yLeftAxis which tries to fit data present on screen every time chart is drawn. When you scroll chart the points with 2.000.000 and 5.000.000 values go outside viewport and auto range calculation is performed on remaining points ( in range 0-100.000 ). As result column series is resized to fit currently present data on screen. If you don’t want this behavior then you can try to remove AutoRange.Always and then set some VisibleRange which won’t be changed in further ( e.g. from 0 to 150.000 or some other value which is equal to max possible Volume value). Can you try it and let me know if it helps?
- You must login to post comments
On the attached image you can see what happend when I removed ‘AutoRange.Always’
What do you mean by “set some VisibleRange which won’t be changed in further ( e.g. from 0 to 150.000 or some other value which is equal to max possible Volume value)”?
Should I add some check for values and if they are between some values (in your example 0..150.000) and made some specific actions over the chart?
- Alexey Tsukanov answered 5 years ago
-
Well to better understand what is happening I would suggest you to comment code which hides labels for yLeftAxis and try to scroll chart. You should see that on scroll VisibleRange changes to fit data on screen ( e.g. if you have 3.000.000 point on screen auto range logic will change VisibleRange to such value that it will be inside chart’s viewport, then when it will be outside VisibleRange of xAxis auto range logic will calculate new VisibleRange value for yAxis to fit remaining points ). So to prevent this behavior I suggested to remove using of AutoRange.Always and instead pick up some VisibleRange value so it will display Volume data correctly ( without clipping of series if range is too small or without rendering too small columns if range is too big ) and set it once when chart is created. In this case Volume scale won’t change when you scroll chart.
-
Thank you, I’ll try it and let you know about result!
- You must login to post comments
Please login first to submit.