You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/12/06 02:43:30 UTC
[GitHub] DorisOu opened a new issue #9535: 地图中示例【北京公交线路图】How to randomly set lineStyle color
DorisOu opened a new issue #9535: 地图中示例【北京公交线路图】How to randomly set lineStyle color
URL: https://github.com/apache/incubator-echarts/issues/9535
$.getJSON('lines.json', function(data) {
var points = [];
function busLines(data) {
for (var i = 0; i < data.length; i++) {
var userId = data[i].userID;
var time = data[i].time;
var coords = data[i].coords;
if (mobile == userId) {
if (time == traceBegin || time == traceEnd) {
points.push(coords)
console.log(typeof(points));
}
}
}
return points
}
option = {
bmap: {
center: [113.39942, 22.522314],
zoom: 13,
roam: true,
mapStyle: mapStyle
},
series: [{
type: 'lines',
coordinateSystem: 'bmap',
polyline: true,
data: busLines(data),
silent: true,
lineStyle: {
normal: {
opacity: 0.2,
width: 1
}
},
progressiveThreshold: 500,
progressive: 100
}, {
type: 'lines',
coordinateSystem: 'bmap',
polyline: true,
data: busLines(data),
lineStyle: {
normal: {
width: 0
}
},
effect: {
constantSpeed: 20,
show: true,
trailLength: 0.1,
symbolSize: 1.5
},
zlevel: 1
}]
};
myChart.setOption(option);
});
my data in lines.json like this:
{
"userID": 11,
"time": "2018-12-01",
"coords": [
[113.26538255357309, 22.61228326802681],
[113.26631345072312, 22.60978325612234],
[113.26538255357309, 22.61228326802681],
[113.26631345072312, 22.60978325612234],
[113.26538255357309, 22.61228326802681],
[113.26631345072312, 22.60978325612234]
]
},
{
"userID": 22,
"time": "2018-12-03",
"coords": [
[113.32598516805832, 22.570791601333816],
[113.34085573622079, 22.564758882252857],
[113.3278424516713, 22.569430107631028]
]
}
if I use this bellow codes, it doesnot work
return {
coords: points,
lineStyle: {
normal: {
color: echarts.color.modifyHSL('#5A94DF', Math.round(hStep * idx))
}
}
}
how to set lineStyle's ramdom color in this situation?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org