angular - 在 Angular 8 应用程序中使用 HighCharts styledMode
问题描述
我正在使用 highcharts-angular v2.4.0 和 highcharts v7.1.2 开发 Angular 8 应用程序
我在我的打字稿chartOptions中将图表styledMode设置为true,并将以下内容放在组件scss文件中
.highcharts-pie-series.highcharts-legend-item.highcharts-color-0 {
text {
font-size: 50px;
}
}
我已阅读 Highcharts 上有关应用主题或覆盖样式的文章,但我尝试的任何操作都不会对生成的饼图或图例产生任何影响。我错过了什么?
解决方案
不幸的是,当使用样式模式时,您必须全局添加样式。
在里面angular-cli.json
添加图表样式的 CSS 文件(chart-styles.css 和 theme.css 下面):
{
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": ["assets", "favicon.ico"],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"prefix": "app",
"styles": ["styles.css", "theme.css", "chart-styles.css"],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
]
}
演示:
推荐阅读
- c++ - 有条件地声明成员函数的简单 SFINAE 问题
- stanford-nlp - 我可以在不下载语言模块的情况下运行 stanza NER 吗?
- php - php + mysql still commiting
- django - 如何向 Django 添加禁用属性
- css - react bootstrap中如何保持图片和卡片的大小比例一致?
- xml - 为什么 xs:precisionDecimal 不是 XSD1.1 的一部分?
- javascript - Vue.js:在方法中使用计算属性返回未定义的错误
- google-cloud-platform - 有没有办法确定 GCP 上的自定义机器类型是 N1 还是 N2?
- python - Python:使用列表作为字典键
- python - tensorflow 无法在热切张量中分配的解决方法