在 amchart 中用折线图在条形图中显示背景阴影
show background shadow on line in bar with line chart in amchart
目前,我有一个结合了条形图和折线图的图表,我想在折线图上显示阴影,有没有办法在背景上显示阴影
这是创建折线图的示例代码
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";
<filter id="shadow">
<feDropShadow dx="1" dy="5" stdDeviation="2"/>
</filter>
使用给定的过滤器创建一个函数,并在使用过滤器 ID #shadow 的行中传递它。
我得到了在折线图中的线条上制作阴影的解决方案。首先,你必须制作一个 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"
}
}
};
然后您只需要在像
这样绑定图表数据时将JSON对象添加到图表
chart.defs = defs; //def object
var chart = AmCharts.makeChart("amchartdiv", chart, theme);
目前,我有一个结合了条形图和折线图的图表,我想在折线图上显示阴影,有没有办法在背景上显示阴影
这是创建折线图的示例代码
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";
<filter id="shadow">
<feDropShadow dx="1" dy="5" stdDeviation="2"/>
</filter>
使用给定的过滤器创建一个函数,并在使用过滤器 ID #shadow 的行中传递它。
我得到了在折线图中的线条上制作阴影的解决方案。首先,你必须制作一个 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"
}
}
};
然后您只需要在像
这样绑定图表数据时将JSON对象添加到图表chart.defs = defs; //def object
var chart = AmCharts.makeChart("amchartdiv", chart, theme);