Skip to content
Snippets Groups Projects
Commit 4f023189 authored by Michael Hartung's avatar Michael Hartung
Browse files

node shadow for expression pie charts

parent 9720c54f
No related branches found
No related tags found
No related merge requests found
...@@ -134,7 +134,7 @@ export function downLoadFile(data: any, type: string, fmt: string) { ...@@ -134,7 +134,7 @@ export function downLoadFile(data: any, type: string, fmt: string) {
} }
export function pieChartContextRenderer({ ctx, x, y, state: { selected, hover }, style, label }) { export function pieChartContextRenderer({ ctx, x, y, state: { selected, hover }, style, label }) {
ctx.drawPieLabel = function(style, x, y, label) { ctx.drawPieLabel = function(style, x, y, label) {
ctx.font = "normal 12px sans-serif"; ctx.font = "normal 12px sans-serif";
ctx.textAlign = "center"; ctx.textAlign = "center";
ctx.textBaseline = "middle"; ctx.textBaseline = "middle";
...@@ -146,19 +146,20 @@ export function pieChartContextRenderer({ ctx, x, y, state: { selected, hover }, ...@@ -146,19 +146,20 @@ export function pieChartContextRenderer({ ctx, x, y, state: { selected, hover },
const total = 1; const total = 1;
let lastend = 0; let lastend = 0;
// color gradient attempt // draw shadow
// const gradient = ctx.createLinearGradient(0, 0, 200, 0); if (style.shadow) {
// gradient.addColorStop(0, "white"); ctx.shadowColor = style.shadowColor;
// gradient.addColorStop(1, "red"); ctx.shadowOffsetX = style.shadowX;
// ctx.fillStyle = gradient; ctx.shadowOffsetY = style.shadowY;
// ctx.strokeStyle = gradient; ctx.shadowBlur = 10;
}
ctx.fillStyle = style.color ? style.color : "red"; ctx.fillStyle = style.color ? style.color : "red";
ctx.strokeStyle = "black"; ctx.strokeStyle = "black";
ctx.lineWidth = 2; ctx.lineWidth = 2;
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(x, y); ctx.moveTo(x, y);
var len = (style.opacity/total) * 2 * Math.PI; var len = style.opacity/total * 2 * Math.PI;
ctx.arc(x , y, style.size, lastend, lastend + len, false); ctx.arc(x , y, style.size, lastend, lastend + len, false);
ctx.lineTo(x, y); ctx.lineTo(x, y);
ctx.fill(); ctx.fill();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment