Mp android 图表不支持针对有效 x 轴值的空 y 轴值

[我正在使用 MP Chart for android version v3.1.0,对于股票相关图表,我正在获取日期和价值数据,我正在绘制图表。我正在获取从晚上 7 点到凌晨 1 点(我用于 x 轴值)的所有日期/时间数据,这些数据可以为空。 例如:股票市场从上午 9 点开始,然后在下午 4 点收盘,在上午 12 点我将在上午 9 点到上午 12 点之间有 y 值(股票价格值),但在上午 12 点到下午 4 点之间为空值。 所以我想显示空 y 值的空白空间。除了空白图形逻辑之外,我已经完成了所有工作。第一张图片是我已经完成的工作。this i have done already

和第二张图片是我想显示的方式(只是空白的 y 值,我有空值(没有这条灰线,只是空白的 this is how i want to show (just blank y values for which i have null values(without this grey line,just blank)

    private fun updateGraph(entryMap: MutableMap<Float,Double?>?,patternFormat: String?) {
    with(binding) {
        lines.clear()
        investmentPerformanceChartLoading.isVisible = false
        StocksMiniAppchartsHelperNew.configureLineChart(investmentPerformanceChart,MiniAppsMarkerViewForeignStocks(investmentPerformanceChart,patternFormat),dateFormat = patternFormat)
        val colors = investmentPerformanceChart.context.run {
            listOf(getcolorById(R.color.white_color),getcolorById(R.color.colorPrimary),getcolorById(R.color.graph_large_cap))
        }
        val lineDataSet = LineDataSet(entryMap?.map { item ->
            item.value?.toFloat()?.let { Entry(item.key,it,item) }
        },"")
        lineDataSet.setDrawHorizontalHighlightIndicator(false)
        lineDataSet.highLightColor = context.getcolorById(R.color.white_color)
        lines.add(lineDataSet)
        lines.forEachIndexed { index,list -> StocksChartsHelper.configureLineDataSet(list,colors[index],true) }

        val data = LineData(lines.toList())
        investmentPerformanceChart.data = data
        updateGraphHeight()
        investmentPerformanceChart.highlightvalue(null)
        investmentPerformanceChart.animateX(500)
        if (!entryMap.isnullOrEmpty()) {
            investmentPerformanceChart.alpha = 1f
        } else {
            investmentPerformanceChart.alpha = 0.5f
        }
    }
}

实际上 Entry 接受两个参数的非空浮点值,所以我只向映射发送非空值,但您可以考虑 entryMap 的第一个参数可以具有空值

charmprefect 回答:Mp android 图表不支持针对有效 x 轴值的空 y 轴值

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/56029.html

大家都在问