MCPcopy Create free account
hub / github.com/CoderOpen/waimai / drawPointShape

Function drawPointShape

front/components/u-charts/u-charts.js:1460–1502  ·  view source on GitHub ↗
(points, color, shape, context, opts)

Source from the content-addressed store, hash-verified

1458}
1459
1460function drawPointShape(points, color, shape, context, opts) {
1461 context.beginPath();
1462 context.setStrokeStyle("#ffffff");
1463 context.setLineWidth(1 * opts.pixelRatio);
1464 context.setFillStyle(color);
1465 if (shape === 'diamond') {
1466 points.forEach(function(item, index) {
1467 if (item !== null) {
1468 context.moveTo(item.x, item.y - 4.5);
1469 context.lineTo(item.x - 4.5, item.y);
1470 context.lineTo(item.x, item.y + 4.5);
1471 context.lineTo(item.x + 4.5, item.y);
1472 context.lineTo(item.x, item.y - 4.5);
1473 }
1474 });
1475 } else if (shape === 'circle') {
1476 points.forEach(function(item, index) {
1477 if (item !== null) {
1478 context.moveTo(item.x + 3.5 * opts.pixelRatio, item.y);
1479 context.arc(item.x, item.y, 4 * opts.pixelRatio, 0, 2 * Math.PI, false);
1480 }
1481 });
1482 } else if (shape === 'rect') {
1483 points.forEach(function(item, index) {
1484 if (item !== null) {
1485 context.moveTo(item.x - 3.5, item.y - 3.5);
1486 context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
1487 }
1488 });
1489 } else if (shape === 'triangle') {
1490 points.forEach(function(item, index) {
1491 if (item !== null) {
1492 context.moveTo(item.x, item.y - 4.5);
1493 context.lineTo(item.x - 4.5, item.y + 4.5);
1494 context.lineTo(item.x + 4.5, item.y + 4.5);
1495 context.lineTo(item.x, item.y - 4.5);
1496 }
1497 });
1498 }
1499 context.closePath();
1500 context.fill();
1501 context.stroke();
1502}
1503
1504function drawRingTitle(opts, config, context, center) {
1505 var titlefontSize = opts.title.fontSize || config.titleFontSize;

Callers 4

drawAreaDataPointsFunction · 0.85
drawLineDataPointsFunction · 0.85
drawMixDataPointsFunction · 0.85
drawRadarDataPointsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected