コード例 #1
0
ファイル: DrawSerieRing.cs プロジェクト: zcf112/UnityDemo
        private void UpdateTooltip()
        {
            bool showTooltip = false;

            foreach (var serie in chart.series.list)
            {
                int index = chart.tooltip.runtimeDataIndex[serie.index];
                if (index < 0)
                {
                    continue;
                }
                showTooltip = true;
                var content = TooltipHelper.GetFormatterContent(chart.tooltip, index, chart);
                TooltipHelper.SetContentAndPosition(chart.tooltip, content.TrimStart(), chart.chartRect);
            }
            chart.tooltip.SetActive(showTooltip);
        }
コード例 #2
0
        protected override void UpdateTooltip()
        {
            var xData = m_Tooltip.runtimeXValues[0];
            var yData = m_Tooltip.runtimeYValues[0];

            if (IsCategory() && (xData < 0 || yData < 0))
            {
                return;
            }
            sb.Length = 0;
            for (int i = 0; i < m_Series.Count; i++)
            {
                var serie  = m_Series.GetSerie(i);
                var xAxis  = m_XAxises[serie.axisIndex];
                var yAxis  = m_YAxises[serie.axisIndex];
                var xCount = xAxis.data.Count;
                var yCount = yAxis.data.Count;
                if (serie.show && serie.type == SerieType.Heatmap)
                {
                    if (IsCategory())
                    {
                        string key       = serie.name;
                        var    serieData = serie.data[(int)xData * yCount + (int)yData];
                        var    value     = serieData.data[2];
                        var    color     = m_VisualMap.enable ? m_VisualMap.GetColor(value) :
                                           m_ThemeInfo.GetColor(serie.index);
                        sb.Append("\n")
                        .Append(key).Append(!string.IsNullOrEmpty(key) ? "\n" : "")
                        .Append("<color=#").Append(ChartCached.ColorToStr(color)).Append(">● </color>")
                        .Append(xAxis.data[(int)xData]).Append(": ")
                        .Append(ChartCached.FloatToStr(value, string.Empty));
                    }
                }
            }
            TooltipHelper.SetContentAndPosition(tooltip, sb.ToString().Trim(), chartRect);
            m_Tooltip.SetActive(true);

            for (int i = 0; i < m_XAxises.Count; i++)
            {
                UpdateAxisTooltipLabel(i, m_XAxises[i]);
            }
            for (int i = 0; i < m_YAxises.Count; i++)
            {
                UpdateAxisTooltipLabel(i, m_YAxises[i]);
            }
        }
コード例 #3
0
        protected override void UpdateTooltip()
        {
            base.UpdateTooltip();
            bool showTooltip = false;

            foreach (var serie in m_Series.list)
            {
                int index = m_Tooltip.runtimeDataIndex[serie.index];
                if (index < 0)
                {
                    continue;
                }
                showTooltip = true;
                var content = TooltipHelper.GetFormatterContent(m_Tooltip, index, m_Series, m_ThemeInfo);
                TooltipHelper.SetContentAndPosition(tooltip, content, chartRect);
            }
            m_Tooltip.SetActive(showTooltip);
        }
コード例 #4
0
        protected void UpdateTooltip()
        {
            int serieIndex = chart.tooltip.runtimeDataIndex[0];

            if (serieIndex < 0)
            {
                if (chart.tooltip.IsActive())
                {
                    chart.tooltip.SetActive(false);
                    chart.RefreshChart();
                }
                return;
            }
            chart.tooltip.SetActive(true);
            var serie     = chart.series.GetSerie(serieIndex);
            var radar     = chart.radars[serie.radarIndex];
            var dataIndex = chart.tooltip.runtimeDataIndex[1];
            var content   = TooltipHelper.GetFormatterContent(chart.tooltip, dataIndex, chart, null, false, radar);

            TooltipHelper.SetContentAndPosition(chart.tooltip, content, chart.chartRect);
        }
コード例 #5
0
        protected override void UpdateTooltip()
        {
            base.UpdateTooltip();
            int serieIndex = m_Tooltip.runtimeDataIndex[0];

            if (serieIndex < 0)
            {
                if (m_Tooltip.IsActive())
                {
                    m_Tooltip.SetActive(false);
                    RefreshChart();
                }
                return;
            }
            m_Tooltip.SetActive(true);
            var           serie = m_Series.GetSerie(serieIndex);
            var           radar = m_Radars[serie.radarIndex];
            StringBuilder sb    = new StringBuilder();

            TooltipHelper.InitRadarTooltip(ref sb, tooltip, serie, radar, themeInfo);
            TooltipHelper.SetContentAndPosition(tooltip, sb.ToString(), chartRect);
        }
コード例 #6
0
        protected override void DrawTooltip(VertexHelper vh)
        {
            if (tooltip.runtimeAngle < 0)
            {
                return;
            }
            var m_Polar      = GetPolar(tooltip.runtimePolarIndex);
            var m_AngleAxis  = GetAngleAxis(m_Polar.index);
            var lineColor    = TooltipHelper.GetLineColor(tooltip, m_Theme);
            var lineType     = tooltip.lineStyle.GetType(m_Theme.tooltip.lineType);
            var lineWidth    = tooltip.lineStyle.GetWidth(m_Theme.tooltip.lineWidth);
            var cenPos       = m_Polar.runtimeCenterPos;
            var radius       = m_Polar.runtimeRadius;
            var sp           = m_Polar.runtimeCenterPos;
            var tooltipAngle = tooltip.runtimeAngle + m_AngleAxis.runtimeStartAngle;
            var ep           = ChartHelper.GetPos(sp, radius, tooltipAngle, true);

            switch (tooltip.type)
            {
            case Tooltip.Type.Corss:
                ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
                var dist = Vector2.Distance(pointerPos, cenPos);
                if (dist > radius)
                {
                    dist = radius;
                }
                var outsideRaidus = dist + tooltip.lineStyle.GetWidth(m_Theme.tooltip.lineWidth) * 2;
                UGL.DrawDoughnut(vh, cenPos, dist, outsideRaidus, lineColor, Color.clear);
                break;

            case Tooltip.Type.Line:
                ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
                break;

            case Tooltip.Type.Shadow:
                UGL.DrawSector(vh, cenPos, radius, lineColor, tooltipAngle - 2, tooltipAngle + 2, settings.cicleSmoothness);
                break;
            }
        }
コード例 #7
0
        protected override void UpdateTooltip()
        {
            base.UpdateTooltip();
            int serieIndex = m_Tooltip.runtimeDataIndex[0];

            if (serieIndex < 0)
            {
                if (m_Tooltip.IsActive())
                {
                    m_Tooltip.SetActive(false);
                    RefreshChart();
                }
                return;
            }
            m_Tooltip.SetActive(true);
            var serie     = m_Series.GetSerie(serieIndex);
            var radar     = m_Radars[serie.radarIndex];
            var dataIndex = tooltip.runtimeDataIndex[1];
            var content   = TooltipHelper.GetFormatterContent(m_Tooltip, dataIndex, m_Series, m_ThemeInfo, null, null, false, radar);

            TooltipHelper.SetContentAndPosition(tooltip, content, chartRect);
        }
コード例 #8
0
 private void InitTooltip()
 {
     tooltip.painter          = m_PainterTop;
     tooltip.refreshComponent = delegate()
     {
         tooltip.gameObject = ChartHelper.AddObject("tooltip", transform, m_ChartMinAnchor,
                                                    m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);
         var tooltipObject = tooltip.gameObject;
         tooltipObject.transform.localPosition = Vector3.zero;
         tooltipObject.hideFlags = chartHideFlags;
         DestroyImmediate(tooltipObject.GetComponent <Image>());
         var parent    = tooltipObject.transform;
         var textStyle = tooltip.textStyle;
         ChartHelper.HideAllObject(tooltipObject.transform);
         GameObject content = ChartHelper.AddTooltipContent("content", parent, textStyle, m_Theme);
         tooltip.SetObj(tooltipObject);
         tooltip.SetContentObj(content);
         tooltip.SetContentBackgroundColor(TooltipHelper.GetTexBackgroundColor(tooltip, m_Theme.tooltip));
         tooltip.SetContentTextColor(TooltipHelper.GetTexColor(tooltip, m_Theme.tooltip));
         tooltip.SetActive(false);
     };
     tooltip.refreshComponent();
 }