css - 我们如何为 Gchart 添加自定义 CSS?
问题描述
我需要在我的 Gchart 中添加自定义 css。我可以将索引标签放在同一行中。我还想为索引标签提供自定义字体。在检查页面时,所有索引都在 g 标签内,我为 g 标签添加了 css,但它不起作用。我还需要修改工具提示样式并从每个图表切片中删除“%”。我怎样才能做到这一点?
我的代码:
<style>
.myPanel.ui-panel{
width:55% !important;
}
g{
font-family: Verdana !important;
display: block !important;
}
</style>
<div id="savChart">
<pe:gChart value="#{dashboardMB.dynamicChartObj}" width="500" height="400"
title="Quanity Wise">
</pe:gChart>
</div>
解决方案
对于 GGcharts,请参阅有关如何自定义颜色的文档:https ://developers.google.com/chart/interactive/docs/customizing_charts
然后在你的 GChartModelBuilder 做这样的事情..
new GChartModelBuilder()
.setChartType(getChartType())
.addOption("fontName", "Roboto")
.addOption("colors", Arrays.asList("#e0440e", "#e6693e"))
.addColumns(new DefaultGChartModelColumn("Topping", "string"),
new DefaultGChartModelColumn("Slices", "number"))
.addRow("Mushrooms", mushrooms).addRow("Onions", onions).build();
推荐阅读
- reactjs - 如何设置 react-data-grid 的动态高度
- java - 在 Freemarker 模板引擎中读取导致 TemplateException 的 Java 对象
- python - 哪个会更快:redis 扫描匹配或首先从 mysql 检索可能的键?
- c++ - 如何在 Particle (Spark) 的本地构建中包含第三方库?
- android - 即使传递给回调的列表为空,如何继续向服务器发送请求以获取 loadAfter() 中的下一个项目?
- drools - Drool 查询在 LHS 中使用时行为不稳定
- python-requests - 如何修复“OSError:无法识别图像文件”?我正在尝试通过传递图像 url 来获取图像大小
- python - 在列表理解中理解这个 if 语句
- mongodb - 如何将csv文件导入mongoDB,其中mongo字段具有数组字段
- python - 当工人被杀时,芹菜中重新排队任务的默认等待时间是多少?