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

Function getCandleToolTipData

front/components/u-charts/u-charts.js:562–625  ·  view source on GitHub ↗
(series, seriesData, calPoints, index, categories, extra)

Source from the content-addressed store, hash-verified

560}
561
562function getCandleToolTipData(series, seriesData, calPoints, index, categories, extra) {
563 var option = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
564 let upColor = extra.color.upFill;
565 let downColor = extra.color.downFill;
566 //颜色顺序为开盘,收盘,最低,最高
567 let color = [upColor, upColor, downColor, upColor];
568 var textList = [];
569 let text0 = {
570 text: categories[index],
571 color: null
572 };
573 textList.push(text0);
574 seriesData.map(function(item) {
575 if (index == 0 && item.data[1] - item.data[0] < 0) {
576 color[1] = downColor;
577 } else {
578 if (item.data[0] < series[index - 1][1]) {
579 color[0] = downColor;
580 }
581 if (item.data[1] < item.data[0]) {
582 color[1] = downColor;
583 }
584 if (item.data[2] > series[index - 1][1]) {
585 color[2] = upColor;
586 }
587 if (item.data[3] < series[index - 1][1]) {
588 color[3] = downColor;
589 }
590 }
591 let text1 = {
592 text: '开盘:' + item.data[0],
593 color: color[0]
594 };
595 let text2 = {
596 text: '收盘:' + item.data[1],
597 color: color[1]
598 };
599 let text3 = {
600 text: '最低:' + item.data[2],
601 color: color[2]
602 };
603 let text4 = {
604 text: '最高:' + item.data[3],
605 color: color[3]
606 };
607 textList.push(text1, text2, text3, text4);
608 });
609 var validCalPoints = [];
610 var offset = {
611 x: 0,
612 y: 0
613 };
614 for (let i = 0; i < calPoints.length; i++) {
615 let points = calPoints[i];
616 if (typeof points[index] !== 'undefined' && points[index] !== null) {
617 validCalPoints.push(points[index]);
618 }
619 }

Callers 1

u-charts.jsFile · 0.85

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected