highcharts 百分比图

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了highcharts 百分比图相关的知识,希望对你有一定的参考价值。

$(function () {

    // Uncomment to style it like Apple Watch
    /*
    if (!Highcharts.theme) {
        Highcharts.setOptions({
            chart: {
                backgroundColor: ‘black‘
            },
            colors: [‘#F62366‘, ‘#9DFF02‘, ‘#0CCDD6‘],
            title: {
                style: {
                    color: ‘silver‘
                }
            },
            tooltip: {
                style: {
                    color: ‘silver‘
                }
            }
        });
    }
    // */

    Highcharts.chart(‘container‘, {

        chart: {
            type: ‘solidgauge‘,
            marginTop: 50
        },

        title: {
            text: ‘Activity‘,
            style: {
                fontSize: ‘24px‘
            }
        },

        tooltip: {
            borderWidth: 0,
            backgroundColor: ‘none‘,
            shadow: false,
            style: {
                fontSize: ‘16px‘
            },
            pointFormat: ‘{series.name}<br><span style="font-size:2em; color: {point.color}; font-weight: bold">{point.y}%</span>‘,
            positioner: function (labelWidth, labelHeight) {
                return {
                    x: 200 - labelWidth / 2,
                    y: 180
                };
            }
        },

        pane: {
            startAngle: 0,
            endAngle: 360,
            background: [{ // Track for Move
                outerRadius: ‘112%‘,
                innerRadius: ‘88%‘,
                backgroundColor: Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0.3).get(),
                borderWidth: 0
            }]
        },

        yAxis: {
            min: 0,
            max: 100,
            lineWidth: 0,
            tickPositions: []
        },

        plotOptions: {
            solidgauge: {
                borderWidth: ‘34px‘,
                dataLabels: {
                    enabled: false
                },
                linecap: ‘round‘,
                stickyTracking: false
            }
        },

        series: [{
            name: ‘Move‘,
            borderColor: Highcharts.getOptions().colors[0],
            data: [{
                color: Highcharts.getOptions().colors[0],
                radius: ‘100%‘,
                innerRadius: ‘100%‘,
                y: 80
            }]
        }]
    },

    /**
     * In the chart load callback, add icons on top of the circular shapes
     */
    function callback() {


      

        // Stand icon
        this.renderer.path([‘M‘, 0, 8, ‘L‘, 0, -8, ‘M‘, -8, 0, ‘L‘, 0, -8, 8, 0])
            .attr({
                ‘stroke‘: ‘#303030‘,
                ‘stroke-linecap‘: ‘round‘,
                ‘stroke-linejoin‘: ‘round‘,
                ‘stroke-width‘: 2,
                ‘zIndex‘: 10
            })
            .translate(190, 96)
            .add(this.series[2].group);
    });


});

  

以上是关于highcharts 百分比图的主要内容,如果未能解决你的问题,请参考以下文章

ggplot:在百分比图上添加频率图

指标包含 grafana 中的标签时的百分比图

怎么用echarts的仪表盘实现百分比图?

Qt+ECharts开发笔记:ECharts的饼图介绍基础使用和Qt封装百分比图Demo

Qt+ECharts开发笔记:ECharts的饼图介绍基础使用和Qt封装百分比图Demo

Qt+ECharts开发笔记:ECharts的饼图介绍基础使用和Qt封装百分比图Demo