Beispiel #1
0
        protected void DrawHeatmapSerie(VertexHelper vh, int colorIndex, Serie serie)
        {
            if (serie.animation.HasFadeOut())
            {
                return;
            }
            var yAxis  = m_YAxises[serie.axisIndex];
            var xAxis  = m_XAxises[serie.axisIndex];
            var xCount = xAxis.data.Count;
            var yCount = yAxis.data.Count;
            var xWidth = m_CoordinateWidth / xCount;
            var yWidth = m_CoordinateHeight / yCount;

            var zeroX       = m_CoordinateX;
            var zeroY       = m_CoordinateY;
            var dataList    = serie.GetDataList();
            var rangeMin    = m_VisualMap.rangeMin;
            var rangeMax    = m_VisualMap.rangeMax;
            var color       = m_ThemeInfo.GetColor(serie.index);
            var borderWidth = serie.itemStyle.show ? serie.itemStyle.borderWidth : 0;
            var borderColor = serie.itemStyle.opacity > 0 ? serie.itemStyle.borderColor : ChartConst.clearColor32;

            borderColor.a = (byte)(borderColor.a * serie.itemStyle.opacity);
            serie.dataPoints.Clear();
            serie.animation.InitProgress(1, 0, xCount);
            var animationIndex     = serie.animation.GetCurrIndex();
            var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
            var dataChanging       = false;

            for (int i = 0; i < xCount; i++)
            {
                for (int j = 0; j < yCount; j++)
                {
                    var dataIndex = i * yCount + j;
                    if (dataIndex >= dataList.Count)
                    {
                        continue;
                    }
                    var serieData = dataList[dataIndex];
                    var dimension = VisualMapHelper.GetDimension(m_VisualMap, serieData.data.Count);
                    if (serie.IsIgnoreIndex(dataIndex, dimension))
                    {
                        serie.dataPoints.Add(Vector3.zero);
                        continue;
                    }
                    var value = serieData.GetCurrData(dimension, dataChangeDuration, yAxis.inverse, yAxis.runtimeMinValue, yAxis.runtimeMaxValue);
                    if (serieData.IsDataChanged())
                    {
                        dataChanging = true;
                    }
                    var pos = new Vector3(zeroX + (i + 0.5f) * xWidth, zeroY + (j + 0.5f) * yWidth);
                    serie.dataPoints.Add(pos);
                    serieData.canShowLabel = false;
                    if (value == 0)
                    {
                        continue;
                    }
                    if (m_VisualMap.enable)
                    {
                        if ((value < rangeMin && rangeMin != m_VisualMap.min) ||
                            (value > rangeMax && rangeMax != m_VisualMap.max))
                        {
                            continue;
                        }
                        if (!m_VisualMap.IsInSelectedValue(value))
                        {
                            continue;
                        }
                        color = m_VisualMap.GetColor(value);
                    }
                    if (animationIndex >= 0 && i > animationIndex)
                    {
                        continue;
                    }
                    serieData.canShowLabel = true;
                    var emphasis = (m_Tooltip.show && i == (int)m_Tooltip.runtimeXValues[0] && j == (int)m_Tooltip.runtimeYValues[0]) ||
                                   m_VisualMap.runtimeSelectedIndex > 0;
                    var rectWid = xWidth - 2 * borderWidth;
                    var rectHig = yWidth - 2 * borderWidth;
                    ChartDrawer.DrawPolygon(vh, pos, rectWid / 2, rectHig / 2, color);
                    if (borderWidth > 0 && !ChartHelper.IsClearColor(borderColor))
                    {
                        ChartDrawer.DrawBorder(vh, pos, rectWid, rectHig, borderWidth, borderColor);
                    }
                    if (m_VisualMap.hoverLink && emphasis && serie.emphasis.show && serie.emphasis.itemStyle.borderWidth > 0)
                    {
                        var emphasisBorderWidth = serie.emphasis.itemStyle.borderWidth;
                        var emphasisBorderColor = serie.emphasis.itemStyle.opacity > 0 ? serie.emphasis.itemStyle.borderColor : ChartConst.clearColor32;
                        ChartDrawer.DrawBorder(vh, pos, rectWid, rectHig, emphasisBorderWidth, emphasisBorderColor);
                    }
                }
            }
            if (!serie.animation.IsFinish())
            {
                serie.animation.CheckProgress(xCount);
                m_IsPlayingAnimation = true;
                RefreshChart();
            }
            if (dataChanging)
            {
                RefreshChart();
            }
        }