我在我的 android 应用程序上使用 SciChart 来显示烛台图。当 y 值很大时,图表可以很好地显示数据。
但是当 y 值较小时,图表显示效果不佳。它具有默认的比例级别。您可以在底部看到值(红色/绿色点),非常接近 y=0 行
即使我尝试增加缩放级别,它似乎也有缩放级别的限制。
任何人都可以给我一些想法来解决这个问题。
贝娄是我目前的实现
private fun getOhlcDataSeries(symbolValues: List<SymbolValue>):
OhlcDataSeries<Date, Double> {
val dataSeries = OhlcDataSeries(Date::class.java, Double::class.javaObjectType)
val dates = symbolValues.map { it.timePeriodStart }
val opens = symbolValues.map { it.priceOpen }
val high = symbolValues.map { it.priceHigh }
val lows = symbolValues.map { it.priceLow }
val closes = symbolValues.map { it.priceClose }
dataSeries.append(dates, opens, high, lows, closes)
return dataSeries
}
val sciChartBuilder = SciChartBuilder.instance()
val priceSeries = getData()
val xAxis = sciChartBuilder.newCategoryDateAxis().build()
val yAxis = sciChartBuilder.newNumericAxis().build()
val dataSeries = getOhlcDataSeries(priceSeries)
val upColor = 0xFF64AA6F.toInt()
val downColor = 0xFFE25C5A.toInt()
val rSeries = sciChartBuilder.newCandlestickSeries()
.withStrokeUp(upColor)
.withFillUpColor(upColor)
.withStrokeDown(downColor)
.withFillDownColor(downColor)
.withDataSeries(dataSeries)
.build()
UpdateSuspender.using(surface) {
Collections.addAll(surface.xAxes, xAxis)
Collections.addAll(surface.yAxes, yAxis)
Collections.addAll(surface.renderableSeries, rSeries)
Collections.addAll(surface.chartModifiers, sciChartBuilder.newModifierGroupWithDefaultModifiers().build())
}
谢谢