Exemplo n.º 1
0
        private void buttonApplySeries_Click(object sender, EventArgs e)
        {
            chartController.LegendPosition = (OxyPlot.Legends.LegendPosition)Enum.Parse(typeof(OxyPlot.Legends.LegendPosition), boxLegendPosition.Text, true);

            chartController.AxisXStyle = (OxyPlot.LineStyle)Enum.Parse(typeof(OxyPlot.LineStyle), boxAxisXStyle.Text, true);
            chartController.AxisXWidth = Convert.ToInt32(numericAxisXWidth.Value);
            chartController.AxisYStyle = (OxyPlot.LineStyle)Enum.Parse(typeof(OxyPlot.LineStyle), boxAxisYStyle.Text, true);
            chartController.AxisYWidth = Convert.ToInt32(numericAxisXWidth.Value);

            if (buttonAxisXColor.Text != "(default)")
            {
                chartController.AxisXColor = buttonAxisXColor.BackColor;
            }
            else
            {
                chartController.AxisXColor = Color.FromName("0");
            }

            if (buttonAxisYColor.Text != "(default)")
            {
                chartController.AxisYColor = buttonAxisYColor.BackColor;
            }
            else
            {
                chartController.AxisYColor = Color.FromName("0");
            }

            var seriesStyle = new SeriesStyle()
            {
                Name       = listKeywords.SelectedItem.ToString(),
                LineStyle  = (OxyPlot.LineStyle)Enum.Parse(typeof(OxyPlot.LineStyle), boxLineStyle.Text, true),
                LineWidth  = Convert.ToInt32(numericLineWidth.Value),
                LineSmooth = checkSmooth.Checked,
                MarkerType = (OxyPlot.MarkerType)Enum.Parse(typeof(OxyPlot.MarkerType), boxMarkerStyle.Text, true),
                MarkerSize = Convert.ToInt32(numericMarkerSize.Value),
                GroupMode  = (GroupMode)Enum.Parse(typeof(GroupMode), boxGroupMode.Text, true)
            };

            if (buttonLineColor.Text != "(default)")
            {
                seriesStyle.LineColor = buttonLineColor.BackColor;
            }

            if (buttonMarkerBorderColor.Text != "(default)")
            {
                seriesStyle.MarkerColor = buttonMarkerBorderColor.BackColor;
            }

            if (buttonMarkerFill.Text != "(default)")
            {
                seriesStyle.MarkerFillColor = buttonMarkerFill.BackColor;
            }

            chartController.UpdateStyle(seriesStyle);

            UpdateData(sender, e);
        }
Exemplo n.º 2
0
        public void UpdateStyle(SeriesStyle style)
        {
            int index = GetIndex(style.Name);

            if (index == -1)
            {
                listSeriesStyle.Add(style);
            }
            else
            {
                listSeriesStyle[index] = style;
            }
        }
Exemplo n.º 3
0
        public void LoadSettings()
        {
            string filename = System.Windows.Forms.Application.StartupPath + "/mview.ini";

            if (System.IO.File.Exists(filename))
            {
                using (TextReader text = new StreamReader(filename))
                {
                    axisXStyle = (LineStyle)Enum.Parse(typeof(LineStyle), text.ReadLine(), true);
                    axisXWidth = Int32.Parse(text.ReadLine());
                    axisXColor = OxyColor.FromUInt32(UInt32.Parse(text.ReadLine()));

                    axisYStyle = (LineStyle)Enum.Parse(typeof(LineStyle), text.ReadLine(), true);
                    axisYWidth = Int32.Parse(text.ReadLine());
                    axisYColor = OxyColor.FromUInt32(UInt32.Parse(text.ReadLine()));

                    LegendPosition = (OxyPlot.Legends.LegendPosition)Enum.Parse(typeof(OxyPlot.Legends.LegendPosition), text.ReadLine(), true);

                    int count = Int32.Parse(text.ReadLine());

                    for (int iw = 0; iw < count; ++iw)
                    {
                        var tmpStyle = new SeriesStyle();

                        tmpStyle.name            = text.ReadLine();
                        tmpStyle.lineColor       = OxyColor.FromUInt32(UInt32.Parse(text.ReadLine()));
                        tmpStyle.markerColor     = OxyColor.FromUInt32(UInt32.Parse(text.ReadLine()));
                        tmpStyle.markerFillColor = OxyColor.FromUInt32(UInt32.Parse(text.ReadLine()));
                        tmpStyle.markerSize      = Int32.Parse(text.ReadLine());
                        tmpStyle.lineWidth       = Int32.Parse(text.ReadLine());
                        tmpStyle.lineSmooth      = Boolean.Parse(text.ReadLine());
                        tmpStyle.markerType      = (MarkerType)Enum.Parse(typeof(MarkerType), text.ReadLine(), true);
                        tmpStyle.lineStyle       = (LineStyle)Enum.Parse(typeof(LineStyle), text.ReadLine(), true);

                        listSeriesStyle.Add(tmpStyle);
                    }

                    text.Close();
                }
            }
        }
Exemplo n.º 4
0
        private void ButtonSeriesSettingsOnClick(object sender, EventArgs e)
        {
            styleSettings.LegendPosition = (OxyPlot.Legends.LegendPosition)Enum.Parse(typeof(OxyPlot.Legends.LegendPosition), boxLegendPosition.Text, true);

            styleSettings.axisXStyle = (OxyPlot.LineStyle)Enum.Parse(typeof(OxyPlot.LineStyle), boxAxisXStyle.Text, true);
            styleSettings.axisXWidth = Convert.ToInt32(numericAxisXWidth.Value);
            styleSettings.axisYStyle = (OxyPlot.LineStyle)Enum.Parse(typeof(OxyPlot.LineStyle), boxAxisYStyle.Text, true);
            styleSettings.axisYWidth = Convert.ToInt32(numericAxisYWidth.Value);

            if (buttonAxisXColor.Text != "(default)")
            {
                styleSettings.axisXColor = OxyPlot.OxyColor.FromRgb(
                    buttonAxisXColor.BackColor.R,
                    buttonAxisXColor.BackColor.G,
                    buttonAxisXColor.BackColor.B
                    );
            }
            else
            {
                styleSettings.axisXColor = OxyPlot.OxyColor.Parse("None");;
            }

            if (buttonAxisYColor.Text != "(default)")
            {
                styleSettings.axisYColor = OxyPlot.OxyColor.FromRgb(
                    buttonAxisYColor.BackColor.R,
                    buttonAxisYColor.BackColor.G,
                    buttonAxisYColor.BackColor.B
                    );
            }
            else
            {
                styleSettings.axisYColor = OxyPlot.OxyColor.Parse("None");;
            }

            if (listKeywords.SelectedItem == null)
            {
                return;
            }

            var seriesStyle = new SeriesStyle()
            {
                name       = listKeywords.SelectedItem.ToString(),
                lineStyle  = (OxyPlot.LineStyle)Enum.Parse(typeof(OxyPlot.LineStyle), boxLineStyle.Text, true),
                lineWidth  = Convert.ToInt32(numericLineWidth.Value),
                lineSmooth = checkSmooth.Checked,
                markerType = (OxyPlot.MarkerType)Enum.Parse(typeof(OxyPlot.MarkerType), boxMarkerStyle.Text, true),
                markerSize = Convert.ToInt32(numericMarkerSize.Value),
            };

            if (buttonLineColor.Text != "(default)")
            {
                seriesStyle.lineColor = OxyPlot.OxyColor.FromRgb(
                    buttonLineColor.BackColor.R,
                    buttonLineColor.BackColor.G,
                    buttonLineColor.BackColor.B
                    );
            }
            else
            {
                seriesStyle.lineColor = OxyPlot.OxyColor.Parse("None");;
            }

            if (buttonMarkerBorderColor.Text != "(default)")
            {
                seriesStyle.markerColor = OxyPlot.OxyColor.FromRgb(
                    buttonMarkerBorderColor.BackColor.R,
                    buttonMarkerBorderColor.BackColor.G,
                    buttonMarkerBorderColor.BackColor.B
                    );
            }
            else
            {
                seriesStyle.markerColor = OxyPlot.OxyColor.Parse("None");;
            }


            if (buttonMarkerFill.Text != "(default)")
            {
                seriesStyle.markerFillColor = OxyPlot.OxyColor.FromRgb(
                    buttonMarkerFill.BackColor.R,
                    buttonMarkerFill.BackColor.G,
                    buttonMarkerFill.BackColor.B
                    );
            }
            else
            {
                seriesStyle.markerFillColor = OxyPlot.OxyColor.Parse("None");
            }


            styleSettings.UpdateStyle(seriesStyle);

            UpdateData?.Invoke(sender, styleSettings);
        }