简体   繁体   English

仅使用highcharts选项的Highcharts图例自定义CSS样式/格式

[英]Highcharts legend custom css style / format using only highcharts options

I've tried lots of combinations in the legend options of the highcharts object, however I was not able to successfully realize the exact design that the designer made. 我已经在highcharts对象的图例选项中尝试了很多组合,但是我无法成功实现设计人员所做的精确设计。

What I need is to be able to have a legend that looks exactly like this... Wanted legend layout 我需要的是能够拥有一个看起来像这样的图例。

But the closest result that I achieved with the legend options available was this... The closest legend layout I could achieve 但是我使用可用的图例选项获得的最接近结果是... 我可以实现的最接近的图例布局

The properties I used within the highchart object definition were: 我在highchart对象定义中使用的属性是:

legend: {
    enabled: graphProperties.legend.enabled,
    backgroundColor: ...
    borderRadius: ...
    verticalAlign: ...
    align: ...
    borderWidth: ...
    x: ...
    y: ... }

Thank you in advance for any help. 预先感谢您的任何帮助。

Maybe you can use this as a starting point. 也许您可以以此为起点。

http://jsfiddle.net/DqAqu/4/ http://jsfiddle.net/DqAqu/4/

$(function () {
    var chart = new Highcharts.Chart({

        chart: {
            renderTo: 'container', 
            backgroundColor: '#F5F5F5', 
            plotBackgroundColor: '#FFFFFF'
        },

        symbols: [ 'square', 'square' ], 

        legend: {
            backgroundColor: '#F5F5F5',
            layout: 'horizontal',
            floating: true,
            align: 'left',
            verticalAlign: 'top',
            x: 60,
            y: 1,
            shadow: false, 
            border: 0, 
            borderRadius: 0, 
            borderWidth: 0
        },

        xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        },

        series: [{
            data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], 
            color: '#47D147'            
        }, {
            data: [95.6, 54.4, 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1], 
            color: '#19A3FF'            
        }]
    });
});​

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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