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

Function drawPointText

front/components/u-charts/u-charts.js:1545–1566  ·  view source on GitHub ↗
(points, series, config, context)

Source from the content-addressed store, hash-verified

1543}
1544
1545function drawPointText(points, series, config, context) {
1546 // 绘制数据文案
1547 var data = series.data;
1548 points.forEach(function(item, index) {
1549 if (item !== null) {
1550 //var formatVal = series.format ? series.format(data[index]) : data[index];
1551 context.beginPath();
1552 context.setFontSize(series.textSize || config.fontSize);
1553 context.setFillStyle(series.textColor || '#666666');
1554 var value = data[index]
1555 if (typeof data[index] === 'object' && data[index] !== null) {
1556 value = data[index].value
1557 }
1558 var formatVal = series.format ? series.format(value) : value;
1559 context.fillText(String(formatVal), item.x - measureText(formatVal, series.textSize || config.fontSize) / 2, item.y -
1560 2);
1561 context.closePath();
1562 context.stroke();
1563 }
1564 });
1565
1566}
1567
1568function drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context) {
1569 radius -= gaugeOption.width / 2 + config.gaugeLabelTextMargin;

Callers 4

drawColumnDataPointsFunction · 0.85
drawAreaDataPointsFunction · 0.85
drawLineDataPointsFunction · 0.85
drawMixDataPointsFunction · 0.85

Calls 1

measureTextFunction · 0.85

Tested by

no test coverage detected