我想使用 Highcharts 制作圆环图,但我无法将此图表转换为堆叠形式。 Vue.js代码如下:
<template> <div> <b-col md="12" style="margin-top: 40px"> <highcharts :options="pieChartOptions"></highcharts> </b-col> </div> </template> <script> import axios from 'axios' import {mapActions} from "vuex"; import Highcharts from "highcharts"; import {Chart} from 'highcharts-vue' import DashboardTable from "../../components/DashboardTable/DashboardTable"; import Widget from '@/components/Widget/Widget'; export default { name:"TestChart", components: { DashboardTable, Widget, highcharts: Chart }, data(){ return{ pieChartOptions:{ colors: ['#01BAF2', '#71BF45', '#FAA74B', '#B37CD2'], chart: { type: 'pie' }, accessibility: { point: { valueSuffix: '%' } }, title: { text: 'Coffee' }, tooltip: { pointFormat: '{series.name}: <b>{point.percentage:.0f}%</b>' }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, format: '{point.name}: {y} %' }, showInLegend: true } }, series: [{ name: 'Types', colorByPoint: true, innerSize: '75%', data: [{ name: 'Filtre', y: 68.1, }, { name: 'Türk', y: 11.0 }, { name: 'Latte', y: 11.2 }, { name: 'Espresso', y: 9.7 }] }] } } }, } </script> <style> </style>
我创建的图表如下所示:
我正在尝试在 Elasticsearch 中提供堆叠圆环图。这是一个例子:
尝试在“name”和“y”之后添加发音,但没有成功。另外,我是否需要在已安装(或任何方法)中添加子类别?如果您对此有任何想法,我等待您的帮助。
P粉0684862202024-03-20 13:30:52
要在 Highcharts 中创建此类图表,您可以使用旭日系列类型:
series: [{ type: 'sunburst', ... }]
实例: https://jsfiddle.net/BlackLabel/2Ldpvogr/
文档: https: //www.highcharts.com/docs/chart-and-series-types/pie-chart
或者两个具有指定大小
和innerSize
的饼图系列:
chart: { type: 'pie' }, series: [{ size: '60%', ... }, { size: '80%', innerSize: '60%', ... }]
实例: https://jsfiddle.net/BlackLabel/uogq3waf/
文档: https: //www.highcharts.com/docs/chart-and-series-types/sunburst-series