到目前为止,我根据需要放置了绿色标记,并绘制了一个红色标记。唯一剩下的就是突出显示所有绿色和红色标记出现的区域。
$(function () {
$('#container').highcharts({
title: {
text: ''
},
chart: {
backgroundColor: 'rgba(0,0,0,0)',
type: 'scatter',
style: {
fontFamily: 'Helvetica',
fontSize: '16px'
},
width: 500,
height: 500
},
credits: {
enabled: false
},
xAxis: {
minRange: 1,
title: {
enabled: true,
text: 'Strategic Alignment'
},
startOnTick: true,
endOnTick: true,
showLastLabel: true,
min: 0,
max: 5
},
yAxis: {
minRange: 1,
gridLineWidth: 0,
minorGridLineWidth: 0,
title: {
text: 'Process & Technology Integration'
},
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
},
lineWidth: 1,
min: 0,
max: 5
},
tooltip: {
enabled: false,
},
series: [{
showInLegend: false,
name: ' ',
color: 'Red',
lineWidth: 1,
marker: {
radius: 10,
symbol: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABCCAMAAAGA1pGZAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKdUExURQAAAApktw1ktlpDexVgrw1jtnw1YeMMFQ5jtRperIEzXpIsUQ1jthNgsQpkuJ8oSA5itQBqvwhluRJhsgtktmM/dQBpvwFnvyFbph9cqBFhsghlut8NGIowVwhkuQBov5spS/MFCSpXnwVouy9VnA5jtQB/vwBmv54oSABqv68hPABnvxFhsg1jtQxktg5jtQBov3E6a0hLiQ5jtUpJh8MZLQxjtl5CeQtktw5jtQ5itQlluA9itDZSl4YxWgxjtg5itQxjt1FHgwlkuA9itA1itmc+cng3ZQlluYkwWJopSyRZpABqvwBtvz9OkAdluglkuRRgsb8aMFpDfABpv2s8bwdlugBmvw9itUJNjnA6awBnvxFhs9MSIV1CegBovzJTmgJnvilYoC5WnQ9itERNjI8uVOcKEi5VnAxktg5jtQpktw5itQxkt6MmRSJbpfsCAxBisw1itQtkuABqvzdSlgxjtg5itbceNjVTlwBpvwBfvwpku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NH4tna4aypaxByT6OH0KHtf/gecLYqb47nHUDmIfaK01rpbFz4jl6ErvQYgoDazZegpv0P1j++H0E7+L0AAAAASUVORK5CYII=)"
},
data: [
[-9999, 3],
[3, 3],
[3, -9999]
],
dataLabels: {
enabled: false,
}
}, {
showInLegend: false,
type: 'scatter',
data: [
[1.1, 2.1], [3.1, 1.1], [3, 4], [1.9, 1.5], [2.9, 1.9],
],
marker: {
symbol: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAAqCAMAAAFuLbL8AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHdUExURQAAAKP9rZ38qaT9rqP9rQjnIVXxZq7+tqb9r2f0doX5kav+taz+tHb3haX9rq3+tq3+tqH8q6//r6f+slfyZ4f5k1rya6T8rRDoKIb5kh7qNZD6nJv7pqP9rKz/t63+uZT7oCzsQa//t6v+s6P9raj9sZ/8qxnqL6X+sKj9s6r/tKT9rybrPK3/tqT9rFnyagXnHoL4jmr1eaP9raL9rKT9ra7/tmz1eq//tK7/txPpKqX9r6z+tFfzaEzwXqj+sSHrNnT2g67+t4T5kKP9rKL8rLL/sqf9sa3+tqb9sKT9raL9rGDzcVvybCnsPrH+uKT9rqr/tKH8rDfuSqv+tK//taP9rqL9rK3+t6X9sKP9raf9sCPrOaz/uKb9sJv7pqT8rpP6nnr3hzHtRqb9r6T9rab9r6//tz/vUq3+tp/8qoP4j6P8rK7+t63/t6X9rpb7oF7zbkLuVW/2fk3wXnP2ggPmHJ/8qaT9rkfwWqX8r6r/v3z3iov6l578qaj+sqr+s0rvXKX9rmHzca3+tor5l67+tqf9so36mVbyZob5kp//vy7tQ63+uDzvT5n7o6b9r6X9r7//v3b3haH9q538p0rxXKj9sqb9sADmGWv1eqf9sa3+toj5lQ7oJeNLwGMAAACedFJOUwC2weu+//1c7vfuNL3vwXAc9RB0+fH75P/y//D1w0Qs8v8gesuHvv9+9hja//DH+f/1/62m9Tz6MP//1n7//ZD/8qfx0KoU9FTt39H6+f8k52b0//5QurNk9ujx/yiW9Ovx9P/y5J5g/3TQ89logJ/0+f3/+/X/887/9wz0//R8y/2J+Dj0m/Pv+/MI/0j/8I2GBPWr8v/36f/0+Fjz58u8dgAAAAlwSFlzAAAXEQAAFxEByibzPwAAAlFJREFUOE+FlAdXE0EUhZ8lGisx2AsWrBjBgtEgQmzBDkawEbGAim1tGEsUxa5JFFCMT2J+qzPzbsjsIeU7J3n33nlnd8rukpusM3uec0sJZuOlzCV6a6xBR47DjkMU47AOstKc5zWqIsLtIvwsRIzLKDVuFJFH/XIiS3HjGARRXG7lKFhNQU/io1z5m86HteoxLWruWAQFeeEj7jLy5HqiVV+NTOq/USPzbEN1EeQaKJtZfArKYrq65WFoxZmzeg4WvdUy4IXXdEtkqEJWCy+8QNoPb7jE/EyVKPNnCTS+IVklUc3AZahyJBMQNo27IGzWfIGwCW+CsKhl3gBZYJw5ClngO3MKUg5U8Umv8yAM0UWzbovduvdcE5whV28uQMEGBIqWtGTqfAcR8Ur7qJ9KtgfWkPRIuF2eUeGXZMwbEWhWKN+xJM68CIFmOcc2E1WnuAmBoplf1ekaucutJtC87IOg7jEIogeoCjy+RahCrUg6NBOqEt7YFvMeVOTdYm65CV2W9gVqd358gCvHiZTqjB2HK8OFA/oE+O9t+JIkMnKG8Yx9hobEkdCT/RZrTSNzAN6wMzTFr5v3/nmvTrck8YarQXNRw5uoXkcxAoMj7u8L1dXvyGGwgOf6Ph/GXaTbhtAhPO7LYmQSU/vRI6TuIJ9E1zK05Pmpv/ZFGG3DW5Z62CvCkyn+pPTM0KO5Q/P9lDj/b6k2vxsx5mL1mBoa8Oa/pnOm6Tf2mrWTE9w7Hb4y7Nq6kcFAuAPa4n7n1nWQBXzPO5shJ0iW2rqjsiii/6CAKuQej0tdAAAAAElFTkSuQmCC)"
},
dataLabels: {
enabled: false,
}
}
]
});
});
我已为此附加了代码。请帮我解决该怎么做或如何实现这一目标? 这是jsFiddle:http://jsfiddle.net/seebu/g3q8eLq5/#fork
答案 0 :(得分:0)
对于矩形,您可以使用带有四个点的多边形系列作为数据,并将系列颜色设置为某个模式 - 模式可以与Highcharts模式填充插件docs here一起使用。对于与您完全相同的模式,您可能需要创建自己的模式。
定义模式
defs: {
patterns: [{
'id': 'custom-pattern',
'path': {
d: 'M 0 0 L 10 10 M 9 -1 L 11 1 M -1 9 L 1 11',
stroke: 'red',
strokeWidth: 2
}
}]
},
多边形系列的配置:
{
type: 'polygon',
enableMouseTracking: false,
showInLegend: false,
data: [
[50, 10],
[50, 100],
[120, 100],
[120, 10]
],
zIndex: -99,
color: 'url(#custom-pattern)'
}