Ejemplo n.º 1
0
        private void setupScrollbar(ChartTypeMetadata metadata)
        {
            if (metadata.RequireAxes)
            {
                foreach (var chartArea in _chart.ChartAreas)
                {
                    var chartSeries = _chart.Series.Where(s => s.ChartArea == chartArea.Name).ToArray();

                    if (chartSeries.Length == 0)
                    {
                        continue;
                    }

                    var pointsCount = chartSeries.Max(s => s.Points.Count);

                    if (pointsCount <= 60)
                    {
                        continue;
                    }

                    var scrollAxis = chartArea.AxisX;
                    var scrollBar  = scrollAxis.ScrollBar;

                    scrollBar.Size               = 15;
                    scrollBar.ButtonStyle        = ScrollBarButtonStyles.SmallScroll;
                    scrollBar.IsPositionedInside = false;
                    scrollBar.Enabled            = true;
                    scrollBar.BackColor          = Color.FromArgb(235, 235, 235);
                    scrollBar.ButtonColor        = Color.Gainsboro;
                    scrollBar.LineColor          = Color.DarkGray;

                    scrollAxis.ScaleView.Zoom(0, 40);
                }
            }
        }
Ejemplo n.º 2
0
        private static ChartTypeMetadata create(SeriesChartType chartType)
        {
            var type = findChartType(chartType);

            var instance = Activator.CreateInstance(type);

            var result = new ChartTypeMetadata
            {
                Stacked = (bool)type.GetProperty("Stacked").GetValue(instance, null),
                SupportStackedGroups = (bool)type.GetProperty("SupportStackedGroups").GetValue(instance, null),
                CircularChartArea    = (bool)type.GetProperty("CircularChartArea").GetValue(instance, null),
                SwitchValueAxes      = (bool)type.GetProperty("SwitchValueAxes").GetValue(instance, null),
                SideBySideSeries     = (bool)type.GetProperty("SideBySideSeries").GetValue(instance, null),
                StackSign            = (bool)type.GetProperty("StackSign").GetValue(instance, null),
                RequireAxes          = (bool)type.GetProperty("RequireAxes").GetValue(instance, null),
                HundredPercent       = (bool)type.GetProperty("HundredPercent").GetValue(instance, null),

                YValuesPerPoint = (int)type.GetProperty("YValuesPerPoint").GetValue(instance, null),
                IsPointChart    = _pointChartTypes.Any(_ => _.IsAssignableFrom(type)),
                IsPieChart      = _pieChartTypes.Any(_ => _.IsAssignableFrom(type))
            };

            result.CanDisplayMultipleSeries = result.SideBySideSeries || result.Stacked || result.IsPointChart && chartType != SeriesChartType.Kagi;

            return(result);
        }
Ejemplo n.º 3
0
        private void setupScrollbar(Chart chart, ChartTypeMetadata metadata)
        {
            if (Runtime.IsMono)
            {
                throw new NotSupportedException();
            }

            if (metadata.RequireAxes)
            {
                foreach (var chartArea in chart.ChartAreas)
                {
                    var chartSeries = chart.Series.Where(s => s.ChartArea == chartArea.Name).ToArray();

                    if (chartSeries.Length == 0)
                    {
                        continue;
                    }

                    var pointsCount = chartSeries.Max(s => s.Points.Count);

                    if (pointsCount <= 60)
                    {
                        continue;
                    }

                    var scrollAxis = chartArea.AxisX;
                    var scrollBar  = scrollAxis.ScrollBar;

                    scrollBar.Size               = 15;
                    scrollBar.ButtonStyle        = ScrollBarButtonStyles.SmallScroll;
                    scrollBar.IsPositionedInside = false;
                    scrollBar.Enabled            = true;

                    scrollBar.BackColor   = SystemColors.Window;
                    scrollBar.ButtonColor = SystemColors.Control;
                    scrollBar.LineColor   = SystemColors.Control;

                    scrollAxis.ScaleView.Zoom(0, 40);
                }
            }
        }