Update() публичный Метод

public Update ( ) : void
Результат void
Пример #1
0
        /// <summary>
        /// Set colour mapping for the chart.
        /// </summary>
        /// <param name="chartName">The chart name.</param>
        /// <param name="hue">A hue (colour 0 to 360), default 0 (red).</param>
        /// <param name="saturation">A saturation (intensity 0 to 1), default 0.5.</param>
        /// <param name="lightness">A lightness (brightness 0 to 1), default 0.5.</param>
        /// <param name="hsl">The parameter to change for different segments, options are:
        /// "Hue" (default) rainbow colours
        /// "Saturation" increasing intensity of colour
        /// "Lightness" increasing brightness</param>
        /// <param name="start">Starting value for colour variation in the range [0 to 1], default 0.</param>
        /// <param name="end">Ending value for colour variation in the range [0 to 1], default 1.</param>
        /// <param name="centralColour">An optional circular gradient color centered on chart, default "".</param>
        public static void ColourMap(Primitive chartName, Primitive hue, Primitive saturation, Primitive lightness, Primitive hsl, Primitive start, Primitive end, Primitive centralColour)
        {
            Type GraphicsWindowType = typeof(GraphicsWindow);
            Dictionary <string, UIElement> _objectsMap;
            UIElement obj;

            try
            {
                _objectsMap = (Dictionary <string, UIElement>)GraphicsWindowType.GetField("_objectsMap", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase).GetValue(null);
                if (_objectsMap.TryGetValue((string)chartName, out obj))
                {
                    InvokeHelper ret = new InvokeHelper(delegate
                    {
                        try
                        {
                            if (obj.GetType() == typeof(Chart))
                            {
                                Chart chart         = (Chart)obj;
                                chart.hue           = hue;
                                chart.saturation    = saturation;
                                chart.lightness     = lightness;
                                chart.startColor    = start;
                                chart.endColor      = end;
                                chart.centralColour = centralColour;
                                switch (((string)hsl).ToLower())
                                {
                                case "hue":
                                    chart.eHSL = Chart.HSL.HUE;
                                    break;

                                case "saturation":
                                    chart.eHSL = Chart.HSL.SATURATION;
                                    break;

                                case "lightness":
                                    chart.eHSL = Chart.HSL.LIGHTNESS;
                                    break;
                                }
                                chart.Update();
                            }
                        }
                        catch (Exception ex)
                        {
                            Utilities.OnError(Utilities.GetCurrentMethod(), ex);
                        }
                    });
                    FastThread.Invoke(ret);
                }
                else
                {
                    Utilities.OnShapeError(Utilities.GetCurrentMethod(), chartName);
                }
            }
            catch (Exception ex)
            {
                Utilities.OnError(Utilities.GetCurrentMethod(), ex);
            }
        }
Пример #2
0
        /// <summary>
        /// Redraw (update) a chart.
        /// This restores any highlighted segments or applies any modified chart properties.
        /// </summary>
        /// <param name="chartName">The chart name.</param>
        public static void Update(Primitive chartName)
        {
            Type GraphicsWindowType = typeof(GraphicsWindow);
            Dictionary <string, UIElement> _objectsMap;
            UIElement obj;

            try
            {
                _objectsMap = (Dictionary <string, UIElement>)GraphicsWindowType.GetField("_objectsMap", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase).GetValue(null);
                if (_objectsMap.TryGetValue((string)chartName, out obj))
                {
                    InvokeHelper ret = new InvokeHelper(delegate
                    {
                        try
                        {
                            if (obj.GetType() == typeof(Chart))
                            {
                                Chart chart = (Chart)obj;
                                chart.Update();
                            }
                        }
                        catch (Exception ex)
                        {
                            Utilities.OnError(Utilities.GetCurrentMethod(), ex);
                        }
                    });
                    FastThread.Invoke(ret);
                }
                else
                {
                    Utilities.OnShapeError(Utilities.GetCurrentMethod(), chartName);
                }
            }
            catch (Exception ex)
            {
                Utilities.OnError(Utilities.GetCurrentMethod(), ex);
            }
        }
Пример #3
0
        /// <summary>
        /// Set legend properties.
        /// </summary>
        /// <param name="chartName">The chart name.</param>
        /// <param name="scale">A scale factor for the legend and text labels, default 1</param>
        /// <param name="legend">A legend style, options are:
        /// "None" no legend
        /// "Legend" separate legend
        /// "Overlay" names overlaying chart
        /// "Percent" percentages overlaying chart
        /// "Legend_Percent" (default) separate legend and percentages overlaying chart
        /// "</param>
        /// <param name="background">The legend label text background is coloured, "True" or "False" (default).</param>
        public static void Legend(Primitive chartName, Primitive scale, Primitive legend, Primitive background)
        {
            Type GraphicsWindowType = typeof(GraphicsWindow);
            Dictionary <string, UIElement> _objectsMap;
            UIElement obj;

            try
            {
                _objectsMap = (Dictionary <string, UIElement>)GraphicsWindowType.GetField("_objectsMap", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase).GetValue(null);
                if (_objectsMap.TryGetValue((string)chartName, out obj))
                {
                    InvokeHelper ret = new InvokeHelper(delegate
                    {
                        try
                        {
                            if (obj.GetType() == typeof(Chart))
                            {
                                Chart chart = (Chart)obj;
                                switch (((string)legend).ToLower())
                                {
                                case "none":
                                    chart.eLegend = Chart.Legends.NONE;
                                    break;

                                case "legend":
                                    chart.eLegend = Chart.Legends.LEGEND;
                                    break;

                                case "overlay":
                                    chart.eLegend = Chart.Legends.OVERLAY;
                                    break;

                                case "percent":
                                    chart.eLegend = Chart.Legends.PERCENT;
                                    break;

                                case "legend_percent":
                                    chart.eLegend = Chart.Legends.LEGEND_PERCENT;
                                    break;
                                }
                                chart.bLegendBackground = background;
                                chart.legendScale       = scale;
                                chart.Update();
                            }
                        }
                        catch (Exception ex)
                        {
                            Utilities.OnError(Utilities.GetCurrentMethod(), ex);
                        }
                    });
                    FastThread.Invoke(ret);
                }
                else
                {
                    Utilities.OnShapeError(Utilities.GetCurrentMethod(), chartName);
                }
            }
            catch (Exception ex)
            {
                Utilities.OnError(Utilities.GetCurrentMethod(), ex);
            }
        }
Пример #4
0
        /// <summary>
        /// Set chart properties.
        /// </summary>
        /// <param name="chartName">The chart name.</param>
        /// <param name="style">A style for the chart, options are:
        /// "Pie" (default)
        /// "Doughnut"
        /// "Bubble"
        /// "Bar"
        /// "Column"</param>
        /// <param name="scale">A scale factor for the chart, default 1.</param>
        public static void Properties(Primitive chartName, Primitive style, Primitive scale)
        {
            Type GraphicsWindowType = typeof(GraphicsWindow);
            Dictionary <string, UIElement> _objectsMap;
            UIElement obj;

            try
            {
                _objectsMap = (Dictionary <string, UIElement>)GraphicsWindowType.GetField("_objectsMap", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase).GetValue(null);
                if (_objectsMap.TryGetValue((string)chartName, out obj))
                {
                    InvokeHelper ret = new InvokeHelper(delegate
                    {
                        try
                        {
                            if (obj.GetType() == typeof(Chart))
                            {
                                Chart chart = (Chart)obj;
                                switch (((string)style).ToLower())
                                {
                                case "pie":
                                    chart.eStyle = Chart.Styles.PIE;
                                    break;

                                case "doughnut":
                                    chart.eStyle = Chart.Styles.DOUGHNUT;
                                    break;

                                case "bubble":
                                    chart.eStyle = Chart.Styles.BUBBLE;
                                    break;

                                case "bar":
                                    chart.eStyle = Chart.Styles.BAR;
                                    break;

                                case "column":
                                    chart.eStyle = Chart.Styles.COLUMN;
                                    break;
                                }
                                chart.scale = scale;
                                chart.Update();
                            }
                        }
                        catch (Exception ex)
                        {
                            Utilities.OnError(Utilities.GetCurrentMethod(), ex);
                        }
                    });
                    FastThread.Invoke(ret);
                }
                else
                {
                    Utilities.OnShapeError(Utilities.GetCurrentMethod(), chartName);
                }
            }
            catch (Exception ex)
            {
                Utilities.OnError(Utilities.GetCurrentMethod(), ex);
            }
        }