目前,我有一个由条形图和折线图组合而成的图表,我想在折线图上显示阴影,有什么方法可以在背景上显示阴影 这是创建折线图的示例代码
objGraph.fillAlphas = 0;
objGraph.lineAlpha = 0.7;
objGraph.type = "line";
objGraph.title = "îàæï";
objGraph.lineThickness = 4;
//objGraph.lineColor = "#" +
objChartData.lstSerieses[j].Color;
objGraph.lineColor = "#fff";
//objGraph.customBullet = "images/star.png"; // bullet for all data points
objGraph.bullet = "round";
objGraph.bulletSize = 11;
objGraph.bulletColor = "#fff";
objGraph.bulletBorderColor = "#000";
objGraph.bulletBorderThickness = 2;
objGraph.bulletBorderAlpha = 1;
//objGraph.bulletSize = 14; // bullet image should be a
rectangle (width = height)
objGraph.customBulletField = "bullet"; // this will make the graph to display custom bullet (red star)
objGraph.bulletSizeField = "bulletSize";
objGraphdescriptionField = "description";
最佳答案
我找到了在折线图中的线上制作阴影的解决方案。首先,您必须创建一个 JSON 对象,用于创建阴影,例如
var defs = {
"filter" : {
"id": "dropshadow", // id for the line shadow
"x": "-10%", // position from x axis
"y": "-10%", // position from y axis
"width": "120%", // width of shadow
"height": "120%", //height of shadow
"feOffset": {
"result": "offOut",
"in": "SourceAlpha",
"dx": "0", //position from adjecent line along x axis
"dy": "12" //position from adjecent line along y axis
},
"feGaussianBlur": {
"result": "blurOut",
"in": "offOut",
"stdDeviation": "5"
},
"feBlend": {
"in": "SourceGraphic",
"in2": "blurOut",
"mode": "normal"
}
}
};
然后,当您绑定(bind)图表数据时,只需将该 JSON 对象添加到图表即可
chart.defs = defs; //def object
var chart = AmCharts.makeChart("amchartdiv", chart, theme);
关于javascript - 在 amchart 中用折线图显示条形线上的背景阴影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47130668/