简体   繁体   中英

Set backgroundColor on half of the highchart area?

Here's my fiddle: http://jsfiddle.net/highcharts/4rTBY/

chart: {
    renderTo: 'container',
    backgroundColor: {
        linearGradient: { x1: 0, y1: 0,  x2: 0, y2: 0 },
        stops: [
            [0, 'rgb(255, 255, 255)'],
            [0.5, 'rgb(200, 200, 255)']
        ]
    },
    type: 'line'
}

As we use backgroundColor whole background gets colored. I only want 50% of the background of the chart to get colored from the bottom.

Thanks in advance

I appointed three points, all three in the middle of the screen ( x: 0.5 ). The reason for three points is that the rest of the page continues to paint the nearest point's color and it will be gradient if you assign two. I put the first two points near each other so that the gradient effect wont show:

linearGradient: { x1: 0.5, y1: 0.5, x2: 0.5, y2: 0.51, x3: 0.5, y3: 1 },
stops: [[0, 'rgb(255, 255, 255)'],
        [1, 'rgb(200, 200, 255)'],
        [2, 'rgb(200, 200, 255)']]

Here's the fiddle: http://jsfiddle.net/4rTBY/625/

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