Exemplo n.º 1
0
        private Chart AddChartToForm(ChartData chartData)
        {
            var chart = new Chart { Dock = DockStyle.Fill, BackColor = Color.White };
            var title = new Title(chartData.ToString()) { Font = new Font("Verdana", 14.0f) };
            chart.Titles.Add(title);
            chart.Legends.Add(new Legend("Legend"));

            var area = new ChartArea("Main")
            {
                BackColor = Color.White,
                BackSecondaryColor = Color.LightSteelBlue,
                BackGradientStyle = GradientStyle.DiagonalRight,
                AxisY = { Maximum = 100 },
                AxisY2 = { Maximum = 20 }
            };

            area.AxisX.MajorGrid.LineColor = Color.LightSlateGray;
            area.AxisX.TitleFont = new Font("Verdana", 10.0f, FontStyle.Bold);
            area.AxisX.Title = "Date";
            area.AxisY.MajorGrid.LineColor = Color.LightSlateGray;
            area.AxisY.TitleFont = new Font("Verdana", 10.0f, FontStyle.Bold);
            area.AxisY.Title = "Weight";
            area.AxisY2.Title = "Reps";

            chart.ChartAreas.Add(area);

            var seriesColumns1 = new Series("Weights") { ChartType = SeriesChartType.Line, IsValueShownAsLabel = true };
            chart.Series.Add(seriesColumns1);
            var seriesColumns2 = new Series("Reps") { ChartType = SeriesChartType.Line };
            chart.Series.Add(seriesColumns2);

            Controls.Add(chart);

            return chart;
        }
Exemplo n.º 2
0
        public ChartControl(ChartData chartData)
            : base(chartData)
        {
            Chart chart = AddChartToForm(chartData);
            IEnumerable<ExerciseInstance> exercisesInstances = GetExerciseInstances(chartData.Parent.Id);
            AddDataPointsToChart(exercisesInstances, chart);

            InitializeComponent();
        }