简体   繁体   中英

Issue on Styling Highcharts.js Categories Title

Can you please let me know how I can update Highcharts.js Categories Title style at this demo ? so the category title and yAxis satys on same color

I already tried to add the style

   categories: ['Powerlines', 'Roads'],
   style: {
    color:  Highcharts.getOptions().colors[0]
           },

but it didnt work

Update

在此处输入图片说明

http://jsfiddle.net/2GH45/6/ colors[1] for black colors[0] for blue

     $(function () {

    $('#chart2').highcharts({
        chart: {
            type: 'column'
        },
        credits: {
            enabled: false
        },
        title: {
            text: 'The Chart Title Goes Here!',
            style: {
                color: '#5882FA',
                fontWeight: 'normal',
                fontSize: '11',
                marginBottom: '30'
            }
        },

        xAxis: {
            categories: ['Roads', 'Powerlines'],
          //you can configure xAxis labels here:
            labels: {


                style: {
                    color: Highcharts.getOptions().colors[0]
                }
            }

        },
        yAxis: [{ // Primary yAxis
            labels: {
                format: '{value}°C',
                style: {
                    color: Highcharts.getOptions().colors[0]
                }
            },
            title: {
                text: 'Temperature',
                style: {
                    color: Highcharts.getOptions().colors[0]
                }
            }
        }, { // Secondary yAxis
            title: {
                text: 'Rainfall',
                style: {
                    color: Highcharts.getOptions().colors[0]
                }
            },
            labels: {
                format: '{value} mm',
                style: {
                    color: Highcharts.getOptions().colors[0]
                }
            },
            opposite: true
        }],
        legend: {
            enabled: false
        },
        tooltip: {
            formatter: function () {
                return this.x +
                    ' is <b>' + this.y + '</b>';
            }
        },

        /*series: [{
            data: [{
                name: 'Roads',

                y: 200
            }, {
                name: 'Powerlines',
                color: '#FF00FF',
                y: 50
            }]
        }]*/
        series: [{
            name: 'Rainfall',
            type: 'column',
            yAxis: 1,
            data: [49.9, 71.5],
            tooltip: {
                valueSuffix: ' mm'
            }

        }, {
            name: 'Temperature',
            type: 'column',
            data: [7.0, 6.9],
            tooltip: {
                valueSuffix: ' °C'
            }
        }]
    });


});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM