GetLabelHeight() private static method

private static GetLabelHeight ( string text ) : float
text string
return float
Beispiel #1
0
        private void DrawLabelsStacked(int selectedFrame, ChartData cdata, Rect r)
        {
            if (cdata.selectedLabels == null)
            {
                return;
            }
            int numberOfFrames = cdata.NumberOfFrames;

            if (selectedFrame < cdata.firstSelectableFrame || selectedFrame >= cdata.firstFrame + numberOfFrames)
            {
                return;
            }
            selectedFrame -= cdata.firstFrame;
            float num  = r.width / (float)numberOfFrames;
            float num2 = r.x + num * (float)selectedFrame;
            float num3 = cdata.scale[0] * r.height;

            float[] array  = new float[cdata.charts.Length];
            float[] array2 = new float[array.Length];
            float   num4   = 0f;

            for (int i = 0; i < cdata.charts.Length; i++)
            {
                array[i]  = -1f;
                array2[i] = 0f;
                int num5 = cdata.chartOrder[i];
                if (cdata.charts[num5].enabled)
                {
                    float num6 = cdata.charts[num5].data[selectedFrame];
                    if (num6 != -1f)
                    {
                        float num7 = (!cdata.hasOverlay) ? num6 : cdata.charts[num5].overlayData[selectedFrame];
                        if (num7 * num3 > 5f)
                        {
                            array[i]  = (num4 + num7 * 0.5f) * num3;
                            array2[i] = Chart.GetLabelHeight(cdata.selectedLabels[num5]);
                        }
                        num4 += num6;
                    }
                }
            }
            Chart.CorrectLabelPositions(array, array2, r.height);
            for (int j = 0; j < cdata.charts.Length; j++)
            {
                if (array2[j] > 0f)
                {
                    int   num8  = cdata.chartOrder[j];
                    Color color = cdata.charts[num8].color;
                    GUI.contentColor = color * 0.8f + Color.white * 0.2f;
                    float alignment = (float)(((num8 & 1) != 0) ? 0 : -1);
                    float num9      = ((num8 & 1) != 0) ? (num + 1f) : -1f;
                    Chart.DoLabel(num2 + num9, r.y + r.height - array[j] - 8f, cdata.selectedLabels[num8], alignment);
                }
            }
            GUI.contentColor = Color.white;
        }
Beispiel #2
0
        private void DrawLabelsStacked(int selectedFrame, ChartData cdata, Rect r)
        {
            if (cdata.selectedLabels == null)
            {
                return;
            }
            int numberOfFrames = cdata.NumberOfFrames;

            if (selectedFrame < cdata.firstSelectableFrame || selectedFrame >= cdata.firstFrame + numberOfFrames)
            {
                return;
            }
            selectedFrame -= cdata.firstFrame;
            float num1 = r.width / (float)numberOfFrames;
            float num2 = r.x + num1 * (float)selectedFrame;
            float num3 = cdata.scale[0] * r.height;

            float[] ypositions = new float[cdata.charts.Length];
            float[] heights    = new float[ypositions.Length];
            float   num4       = 0.0f;

            for (int index1 = 0; index1 < cdata.charts.Length; ++index1)
            {
                ypositions[index1] = -1f;
                heights[index1]    = 0.0f;
                int index2 = cdata.chartOrder[index1];
                if (cdata.charts[index2].enabled)
                {
                    float num5 = cdata.charts[index2].data[selectedFrame];
                    if ((double)num5 != -1.0)
                    {
                        float num6 = !cdata.hasOverlay ? num5 : cdata.charts[index2].overlayData[selectedFrame];
                        if ((double)num6 * (double)num3 > 5.0)
                        {
                            ypositions[index1] = (num4 + num6 * 0.5f) * num3;
                            heights[index1]    = Chart.GetLabelHeight(cdata.selectedLabels[index2]);
                        }
                        num4 += num5;
                    }
                }
            }
            Chart.CorrectLabelPositions(ypositions, heights, r.height);
            for (int index1 = 0; index1 < cdata.charts.Length; ++index1)
            {
                if ((double)heights[index1] > 0.0)
                {
                    int index2 = cdata.chartOrder[index1];
                    GUI.contentColor = cdata.charts[index2].color * 0.8f + Color.white * 0.2f;
                    float alignment = (index2 & 1) != 0 ? 0.0f : -1f;
                    float num5      = (index2 & 1) != 0 ? num1 + 1f : -1f;
                    Chart.DoLabel(num2 + num5, (float)((double)r.y + (double)r.height - (double)ypositions[index1] - 8.0), cdata.selectedLabels[index2], alignment);
                }
            }
            GUI.contentColor = Color.white;
        }
Beispiel #3
0
        private void DrawLabelsLine(int selectedFrame, ChartData cdata, Rect r)
        {
            if (cdata.selectedLabels == null)
            {
                return;
            }
            int numberOfFrames = cdata.NumberOfFrames;

            if (selectedFrame < cdata.firstSelectableFrame || selectedFrame >= cdata.firstFrame + numberOfFrames)
            {
                return;
            }
            selectedFrame -= cdata.firstFrame;
            float[] array  = new float[cdata.charts.Length];
            float[] array2 = new float[array.Length];
            for (int i = 0; i < cdata.charts.Length; i++)
            {
                array[i]  = -1f;
                array2[i] = 0f;
                float num = cdata.charts[i].data[selectedFrame];
                if (num != -1f)
                {
                    array[i]  = num * cdata.scale[i] * r.height;
                    array2[i] = Chart.GetLabelHeight(cdata.selectedLabels[i]);
                }
            }
            Chart.CorrectLabelPositions(array, array2, r.height);
            float num2 = r.width / (float)numberOfFrames;
            float num3 = r.x + num2 * (float)selectedFrame;

            for (int j = 0; j < cdata.charts.Length; j++)
            {
                if (array2[j] > 0f)
                {
                    Color color = cdata.charts[j].color;
                    GUI.contentColor = (color + Color.white) * 0.5f;
                    float alignment = (float)(((j & 1) != 0) ? 0 : -1);
                    float num4      = ((j & 1) != 0) ? (num2 + 1f) : -1f;
                    Chart.DoLabel(num3 + num4, r.y + r.height - array[j] - 8f, cdata.selectedLabels[j], alignment);
                }
            }
            GUI.contentColor = Color.white;
        }
Beispiel #4
0
        private void DrawLabelsLine(int selectedFrame, ChartData cdata, Rect r)
        {
            if (cdata.selectedLabels == null)
            {
                return;
            }
            int numberOfFrames = cdata.NumberOfFrames;

            if (selectedFrame < cdata.firstSelectableFrame || selectedFrame >= cdata.firstFrame + numberOfFrames)
            {
                return;
            }
            selectedFrame -= cdata.firstFrame;
            float[] ypositions = new float[cdata.charts.Length];
            float[] heights    = new float[ypositions.Length];
            for (int index = 0; index < cdata.charts.Length; ++index)
            {
                ypositions[index] = -1f;
                heights[index]    = 0.0f;
                float num = cdata.charts[index].data[selectedFrame];
                if ((double)num != -1.0)
                {
                    ypositions[index] = num * cdata.scale[index] * r.height;
                    heights[index]    = Chart.GetLabelHeight(cdata.selectedLabels[index]);
                }
            }
            Chart.CorrectLabelPositions(ypositions, heights, r.height);
            float num1 = r.width / (float)numberOfFrames;
            float num2 = r.x + num1 * (float)selectedFrame;

            for (int index = 0; index < cdata.charts.Length; ++index)
            {
                if ((double)heights[index] > 0.0)
                {
                    GUI.contentColor = (cdata.charts[index].color + Color.white) * 0.5f;
                    float alignment = (index & 1) != 0 ? 0.0f : -1f;
                    float num3      = (index & 1) != 0 ? num1 + 1f : -1f;
                    Chart.DoLabel(num2 + num3, (float)((double)r.y + (double)r.height - (double)ypositions[index] - 8.0), cdata.selectedLabels[index], alignment);
                }
            }
            GUI.contentColor = Color.white;
        }