Comments (9)
from aachartcore.
同样的代码, 在其他版本的系统上也有这个问题吗?
from aachartcore.
看你的截图, 似乎不用设置成透明颜色, 直接设置 AAChartModel
对象的背景色和整个大屏同色, 应该也行吧?
public class AAChartModel {
...
public Object backgroundColor; //图表背景色
...
public AAChart backgroundColor(Object prop) {
backgroundColor = prop;
return this;
}
...
}
from aachartcore.
看你的截图, 似乎不用设置成透明颜色, 直接设置
AAChartModel
对象的背景色和整个大屏同色, 应该也行吧?public class AAChartModel { ... public Object backgroundColor; //图表背景色 ... public AAChart backgroundColor(Object prop) { backgroundColor = prop; return this; } ... }
需要设成透明色的唉,因为整个背景是个地图(只是截图里没显示出来)。这个backgroundColor好像不支持透明色,我设成“#00000000”最终显示出来是白色底的
from aachartcore.
同样的代码, 在其他版本的系统上也有这个问题吗?
不会,在模拟器,手机,电视上都安装过,都正常。唯独这个机顶盒里安装不行
from aachartcore.
这个backgroundColor好像不支持透明色,我设成“#00000000”最终显示出来是白色底的
AAChartView
是继承自 WebView
的, 这个 backgroundColor
设置是的绘制图表的 <div>
标签的背景色的.
from aachartcore.
public void setIsClearBackgroundColor(Boolean isClearBackgroundColor) {
this.isClearBackgroundColor = isClearBackgroundColor;
if (this.isClearBackgroundColor) {
this.setBackgroundColor(0);
this.getBackground().setAlpha(0);
} else {
this.setBackgroundColor(1);
this.getBackground().setAlpha(255);
}
}
从上面的代码可以看出, setClearBackgroundColor
才是用来设置 WebView
自身为透明色的.
所以 AAChartView
的内部实现里有这段代码
private void configureChartOptionsAndDrawChart(AAOptions chartOptions) {
if (isClearBackgroundColor) {
chartOptions.chart.backgroundColor("rgba(0,0,0,0)"); //这里就是为了避免开发者忘了设置 `<div>` 的透明度
}
Gson gson = new Gson();
String aaOptionsJsonStr = gson.toJson(chartOptions);
this.optionsJson = aaOptionsJsonStr;
String javaScriptStr = "loadTheHighChartView('"
+ aaOptionsJsonStr + "','"
+ this.contentWidth + "','"
+ this.contentHeight + "')";
this.safeEvaluateJavaScriptString(javaScriptStr);
}
其中
if (isClearBackgroundColor) {
chartOptions.chart.backgroundColor("rgba(0,0,0,0)"); //这里就是为了避免开发者忘了设置 `<div>` 的透明度
}
这段代码, 就是为了避免开发者想要 AAChartView
为透明色, 但是只设置了 setClearBackgroundColor(true)
, 而忘了设置 <div>
的透明度.
综上所述, 想要设置 AAChartView
为透明色, 需要同时保证 WebView
自身和绘制图表的 <div>
都是透明色.
from aachartcore.
同样的代码, 在其他版本的系统上也有这个问题吗?
不会,在模拟器,手机,电视上都安装过,都正常。唯独这个机顶盒里安装不行
所以这个估计是这个 Android 版本系统自身的 bug, 参考:
这里的解决方案, 在 android 4.4.2
上为 AAChartView
额外补充这段代码:
aaChartView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
这是为了关闭 WebView
的硬件加速功能,因为在某些情况下硬件加速会导致背景不透明.
android 4.4.2
时, 添加了这段代码即可).
from aachartcore.
感谢作者!这么详细的解答是我在gayhub上头一次遇到了,真心大写加粗的感谢!!!我这就去试试看!
from aachartcore.
Related Issues (20)
- 范围视图在数据的min=max时,图表上显示空白,有什么办法显示点东西出来? HOT 3
- android端某些图表点击不能显示浮层AATooltip
- Android版本能不能像轮播图一样滑动,一次滑动一个屏幕的宽度?
- Android版能不能设置X轴间隔的固定宽度?
- 请问Android版如何修改横纵坐标的个数?默认的是12个,并且修改坐标点的字体大小以及点位的数值大小? HOT 5
- Android版柱状图的X轴数据超过1000时绘制不出来 HOT 1
- 请问当Y轴数据均为0时,怎么让Y轴0起点在X轴呢?yAxisMin()没效果 HOT 1
- 如何自定义左右两侧数据 HOT 4
- 放在dataBinding 的布局里,直接找不到路径了,不支持吗 HOT 1
- Android版是否不支持桑基图
- 如何动态滚动刷新呀 HOT 1
- 可以添加空数据时设置view吗 HOT 5
- pie设置 HOT 1
- 折线图X轴首位坐标问题,以及marker光圈问题请教 HOT 4
- Y轴数据显示精度问题 HOT 1
- In your readme file, there is a typo: The package name should be com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartView, not com.github.AAChartModel.AAChartCore.AAChartConfiger.AAChartView
- In build.gradle, it should be implementation 'com.github.AAChartModel:AAChartCore:cad1a66ee3', SNAPSHOT does not work. HOT 3
- aa_onlyRefreshTheChartDataWithChartOptionsSeriesArray方法无法减去最后加入的AASeriesElement HOT 19
- 触摸数据条弹出的框里的数据格式要如何自定义显示? HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aachartcore.