highcharts柱状图+折线图

时间:2024-03-15 21:50:44

highcharts柱状图+折线图

<div id="container"
         style="min-width: 280px; height: 233px; margin: 0 auto"></div>
var Ri1 = parseFloat("33.3");
var Ri2 = parseFloat("25.0");
var Ri3 = parseFloat("44.4");
var Ri4 = parseFloat("25.0");
var Ri5 = parseFloat("38.9");
var Ri6 = parseFloat("72.2"); 
var chart1 = new Highcharts.Chart({
            chart: {
                type: 'column',
                renderTo: 'container',
                backgroundColor: 'transparent',
                spacingBottom: 0,
                spacingTop: 0,
                spacingLeft: 0,
                spacingRight: 0
            },
            title: {
                text: ''
            },
            credits: {
                enabled: false
                // 禁用版权信息
            },

            colors: [               
                "#32A6A3",
                "#ED93B5",
                "#FC983B",
            ],
            xAxis: {
                type: 'category',
                tickWidth: 0,//去掉刻度
                gridWidth: 1,
                lineColor: '#ccc',
                categories: ['a', 'b', 'c'],
                minRange: 1,
                tickPixelInterval: 1,
                label: {
                    reserveSpace: false,
                    padding: 0,
                    step: 1,
                    style: {
                        textOverflow: 'none',
                        fontSize: '8px'
                    }
                }
            },

            yAxis: {
                min: 0,
                max: max,
                floor: 0,
                ceiling: 100,
                labels: {
                    enabled: false
                },
                tickWidth: 0,//去掉刻度
                gridLineWidth: 0,//去掉y轴方向的横线
                title: {
                    text: ''
                }
            },
            legend: {
                enabled: false
            },
            plotOptions: {
                column: {
                    dataLabels: {
                        enabled: false,
                        style: {
                            color: '#555',
                            fontWeight: 'normal',
                            border: 1
                        }
                    }
                },
                lines: {
                    dataLabels: {
                        enabled: false

                    }
                },
                series: {
                    borderWidth: 0,
                    dataLabels: {
                        format: '{point.y:.1f}',

                    }
                }
            },

            series: [
                {
                    type: 'column',
                    name: '得分',
                    colorByPoint: true,
                    data: [Ri4, Ri5, Ri6]
                },
                {
                    type: 'line',
                    name: '本型号均值',
                    lineWidth: 1,
                    lineColor: '#888',
                    marker: {
                        fillColor: '#888',
                        lineColor: '#888',
                        symbol: 'circle',
                        lineWidth: 1,
                        radius: 1,
                    },
                    data: [Ri1, Ri2, Ri3]
                }
            ]

        });