Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x轴的y值指示线(动态高度)效果实现 #1383

Closed
54ZiLong opened this issue Sep 1, 2022 · 9 comments
Closed

x轴的y值指示线(动态高度)效果实现 #1383

54ZiLong opened this issue Sep 1, 2022 · 9 comments
Labels

Comments

@54ZiLong
Copy link

54ZiLong commented Sep 1, 2022

截屏2022-09-01 下午9 15 52
请问这个指示线的效果能实现吗

@AAChartModel
Copy link
Owner

这个就只是网格线而已, 实现起来比较简单, 但是你的这个网格线高度不是规则的, 实现起来就比较复杂了.

@54ZiLong
Copy link
Author

54ZiLong commented Sep 2, 2022

有没有示例可供参考呢

@AAChartModel
Copy link
Owner

配置示例:

- (AAOptions *)dynamicHeightGridLineAreaChart {
    return AAOptions.new
    .titleSet(AATitle.new
              .textSet(@"dynamicHeightGridLineAreaChart"))
    .chartSet(AAChart.new
        .typeSet(AAChartTypeScatter)
        .eventsSet(AAChartEvents.new
            .loadSet(@AAJSFunc(function () {
                const chart = this;
                const mainSeries = chart.series[0];
                mainSeries.data.forEach((point, i) => {
                  chart.addSeries({
                    data: [
                      [i, 0],
                      [i, point.y]
                    ]
                  })
                })
              }))))
    .plotOptionsSet(AAPlotOptions.new
        .scatterSet(AAScatter.new
            .lineWidthSet(@2)
            .lineColorSet(@"#dbe751")
            .dashStyleSet(AAChartLineDashStyleTypeLongDash)
            .enableMouseTrackingSet(@false)
            .linkedToSet(@"main")
            .statesSet(AAStates.new
                .inactiveSet(AAInactive.new
                    .enabledSet(false)))
            .markerSet(AAMarker.new
                .enabledSet(false))))
    .yAxisSet(AAYAxis.new
              .gridLineWidthSet(@0))
    .seriesSet(@[
        AASeriesElement.new
            .typeSet(AAChartTypeAreaspline)
            .idSet(@"main")
            .dataSet(@[@7.0, @6.9, @2.5, @14.5, @18.2, @21.5, @5.2, @26.5, @23.3, @45.3, @13.9, @9.6])
            .lineWidthSet(@6)
            .colorSet(@"#dbe751")
            .fillOpacitySet(@0.4)
            .markerSet(AAMarker.new
                .enabledSet(false))
    ]);
}

新增了部分属性及文件, 更新 AAChartKit 至最新内容即可使用.

@AAChartModel
Copy link
Owner

@AAChartModel
Copy link
Owner

@54ZiLong
Copy link
Author

54ZiLong commented Sep 5, 2022

截屏2022-09-05 下午2 24 50

更新了最新版 但是报错,这是什么原因造成的

@AAChartModel
Copy link
Owner

@AAChartModel
Copy link
Owner

应该就是头文件导入的问题, 你改成导入 AAChartKit.h 应该就正常了.

@AAChartModel
Copy link
Owner

截屏2022-09-05 下午9 25 28

我本地测试, 导入 AAChartView.h 报错就是这样的, 与你的报错完全一致, 改为导入 AAChartKit.h 就正常了.

@AAChartModel AAChartModel changed the title x轴的y值指示线效果实现 x轴的y值指示线(动态高度)效果实现 Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants