14 public partial class CoordinateChart
16 protected void DrawHeatmapSerie(VertexHelper vh,
int colorIndex, Serie serie)
18 if (serie.animation.HasFadeOut())
return;
19 var yAxis = m_YAxes[serie.yAxisIndex];
20 var xAxis = m_XAxes[serie.xAxisIndex];
21 xAxis.boundaryGap =
true;
22 yAxis.boundaryGap =
true;
23 var
grid = GetSerieGridOrDefault(serie);
24 var xCount = xAxis.data.Count;
25 var yCount = yAxis.data.Count;
26 var xWidth =
grid.runtimeWidth / xCount;
27 var yWidth =
grid.runtimeHeight / yCount;
29 var zeroX =
grid.runtimeX;
30 var zeroY =
grid.runtimeY;
31 var dataList = serie.GetDataList();
32 var rangeMin = visualMap.rangeMin;
33 var rangeMax = visualMap.rangeMax;
34 var color = m_Theme.GetColor(serie.index);
35 var borderWidth = serie.itemStyle.show ? serie.itemStyle.borderWidth : 0;
36 var borderColor = serie.itemStyle.opacity > 0 ? serie.itemStyle.borderColor : ChartConst.clearColor32;
37 borderColor.a = (byte)(borderColor.a * serie.itemStyle.opacity);
38 var borderToColor = serie.itemStyle.opacity > 0 ? serie.itemStyle.borderToColor : ChartConst.clearColor32;
39 borderToColor.a = (byte)(borderToColor.a * serie.itemStyle.opacity);
40 serie.dataPoints.Clear();
41 serie.animation.InitProgress(1, 0, xCount);
42 var animationIndex = serie.animation.GetCurrIndex();
43 var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
44 var dataChanging =
false;
45 for (
int i = 0; i < xCount; i++)
47 for (
int j = 0; j < yCount; j++)
49 var dataIndex = i * yCount + j;
50 if (dataIndex >= dataList.Count)
continue;
51 var serieData = dataList[dataIndex];
52 var dimension = VisualMapHelper.GetDimension(visualMap, serieData.data.Count);
53 if (serie.IsIgnoreIndex(dataIndex, dimension))
55 serie.dataPoints.Add(Vector3.zero);
58 var value = serieData.GetCurrData(dimension, dataChangeDuration, yAxis.inverse,
59 yAxis.runtimeMinValue, yAxis.runtimeMaxValue);
60 if (serieData.IsDataChanged()) dataChanging =
true;
61 var pos =
new Vector3(zeroX + (i + (xAxis.boundaryGap ? 0.5f : 0)) * xWidth,
62 zeroY + (j + (yAxis.boundaryGap ? 0.5f : 0)) * yWidth);
63 serie.dataPoints.Add(pos);
64 serieData.canShowLabel =
false;
65 if (value == 0)
continue;
68 if ((value < rangeMin && rangeMin != visualMap.min)
69 || (value > rangeMax && rangeMax != visualMap.max))
73 if (!visualMap.IsInSelectedValue(value))
continue;
74 color = visualMap.GetColor(value);
76 if (animationIndex >= 0 && i > animationIndex)
continue;
77 serieData.canShowLabel =
true;
78 var emphasis = (tooltip.show
79 && i == (int)tooltip.runtimeXValues[0]
80 && j == (
int)tooltip.runtimeYValues[0])
81 || visualMap.runtimeSelectedIndex > 0;
82 var rectWid = xWidth - 2 * borderWidth;
83 var rectHig = yWidth - 2 * borderWidth;
84 UGL.DrawRectangle(vh, pos, rectWid / 2, rectHig / 2, color);
85 if (borderWidth > 0 && !ChartHelper.IsClearColor(borderColor))
87 UGL.DrawBorder(vh, pos, rectWid, rectHig, borderWidth, borderColor, borderToColor);
89 if (visualMap.hoverLink && emphasis && serie.emphasis.show
90 && serie.emphasis.itemStyle.borderWidth > 0)
92 var emphasisBorderWidth = serie.emphasis.itemStyle.borderWidth;
93 var emphasisBorderColor = serie.emphasis.itemStyle.opacity > 0
94 ? serie.emphasis.itemStyle.borderColor : ChartConst.clearColor32;
95 var emphasisBorderToColor = serie.emphasis.itemStyle.opacity > 0
96 ? serie.emphasis.itemStyle.borderToColor : ChartConst.clearColor32;
97 UGL.DrawBorder(vh, pos, rectWid, rectHig, emphasisBorderWidth, emphasisBorderColor,
98 emphasisBorderToColor);
102 if (!serie.animation.IsFinish())
104 serie.animation.CheckProgress(xCount);
105 m_IsPlayingAnimation =
true;
106 RefreshPainter(serie);
110 RefreshPainter(serie);