antvis / F2Native

📱📈An elegant, interactive and flexible native charting library for mobile.
https://f2native.antv.vision
MIT License
217 stars 21 forks source link

chart.guide().background().color(), 这里设置渐变色会导致崩溃 #16

Closed yygutn closed 2 years ago

yygutn commented 2 years ago

com.antgroup.antv.f2.F2Guide.GuideBackgroundConfigBuilder#color(com.antgroup.antv.f2.F2Util.ColorGradient)

机型:Android 11,华为P50

测试程序:samples

测试代码: 在对比折线图中增加代码:

F2Guide.GuideBackgroundConfigBuilder backgroundConfigBuilder = new F2Guide.GuideBackgroundConfigBuilder();
        backgroundConfigBuilder.color(new F2Util.ColorLinearGradient()
                .addColorStop(0f, "#FF0033")
                .addColorStop(1f, "#FFFFFF")
                .setPosition(0, 0, 0, canvasView.getHeight())
        );
        backgroundConfigBuilder.leftBottom(new String[]{"min", "min"});
        backgroundConfigBuilder.rightTop(new String[]{"2011-12-11", "max"});
weiqingtangx commented 2 years ago

不好意思,回复晚了。在Guide的Background中颜色暂未支持渐变色的设计,后续会考虑支持。

yygutn commented 2 years ago

不好意思,回复晚了。在Guide的Background中颜色暂未支持渐变色的设计,后续会考虑支持。

大概多久,自己尝试给guide#background加了下渐变色的解析支持,发现android和iOS变现不一致- - iOS的渐变色正常,但是android的这个渐变色变成了全局的渐变色- -

weiqingtangx commented 2 years ago

这个可能是android canvas画笔的一个bug,设置了渐变色,会影响到全局的画笔。暂时还没有排期。

weiqingtangx commented 2 years ago

渐变色的bug已经修复, 修复版本为 2.1.8。 可以这样引入

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
      implementation 'com.github.antvis:2.1.8'
}