Beispiel #1
0
 /// <summary>
 /// Ctor.
 /// </summary>
 public StylisedCluster(Cluster cluster, Associational actualElement, Dictionary <Peak, LineInfo> colours)
 {
     this.Cluster       = cluster;
     this.ActualElement = actualElement;
     this.Colours       = colours;
 }
Beispiel #2
0
 /// <summary>
 /// Ctor.
 /// </summary>
 public StylisedCluster(Cluster cluster)
 {
     this.Cluster       = cluster;
     this.ActualElement = cluster;
 }
Beispiel #3
0
        /// <summary>
        /// Creates the MChart.Plot object
        /// </summary>
        /// <param name="axes">Include axis text (i.e. not a preview)</param>
        /// <param name="toPlot">What will be plotted</param>
        /// <returns>New MChart.Plot object</returns>
        protected MCharting.Plot PrepareNewPlot(bool axes, Associational toPlot, IntensityMatrix sourceMatrix)
        {
            MCharting.Plot plot = new MCharting.Plot();

            PlotSetup setup = this._core.Options.GetPlotSetup(this._core, toPlot);

            if (this._mnuPlot != null)
            {
                if (toPlot != null)
                {
                    this._mnuPlot.Text  = toPlot.DisplayName;
                    this._mnuPlot.Image = UiControls.GetImage(toPlot.Icon, true);

                    if (ParseElementCollection.IsNullOrEmpty(setup.Information))
                    {
                        this._mnuCustomText.Text = "(Click here to configure text)";
                    }
                    else
                    {
                        this._mnuCustomText.Text = setup.Information.ConvertToString(toPlot, this._core);
                    }

                    this._mnuPlot.Visible       = true;
                    this._mnuCustomText.Visible = this._chkShowCustom.Checked;
                }
                else
                {
                    this._mnuPlot.Text          = "No selection";
                    this._mnuPlot.Image         = Resources.IconTransparent;
                    this._mnuPlot.Visible       = false;
                    this._mnuCustomText.Text    = "";
                    this._mnuCustomText.Visible = false;
                }
            }

            if (this._core.Options.NoAxes)
            {
                axes = false;
            }

            if (axes)
            {
                plot.Style.BackColour = this._core.Options.Colours.PlotBackground;

                if (!ParseElementCollection.IsNullOrEmpty(setup.AxisX))
                {
                    plot.XLabel = setup.AxisX.ConvertToString(toPlot, this._core);
                }

                if (!ParseElementCollection.IsNullOrEmpty(setup.AxisY))
                {
                    plot.YLabel = setup.AxisY.ConvertToString(toPlot, this._core);
                }

                if (!ParseElementCollection.IsNullOrEmpty(setup.Title))
                {
                    plot.Title = setup.Title.ConvertToString(toPlot, this._core);
                }

                if (!ParseElementCollection.IsNullOrEmpty(setup.SubTitle))
                {
                    plot.SubTitle = setup.SubTitle.ConvertToString(toPlot, this._core);
                }

                plot.Style.AutoTickX    = false;
                plot.Style.GridStyle    = new Pen(this._core.Options.Colours.MinorGrid, this._core.Options.LineWidth);
                plot.Style.TickStyle    = new Pen(this._core.Options.Colours.MajorGrid, this._core.Options.LineWidth);
                plot.Style.AxisText     = new SolidBrush(this._core.Options.Colours.AxisTitle);
                this.Chart.Style.Margin = new Padding(this._core.Options.Margin);
            }
            else
            {
                plot.Style.BackColour   = this._core.Options.Colours.PreviewBackground;
                plot.Style.AutoTickX    = false;
                plot.Style.AutoTickY    = false;
                plot.Style.GridStyle    = null;
                plot.Style.TickStyle    = null;
                plot.Style.AxisStyle    = null;
                this.Chart.Style.Margin = Padding.Empty;
            }

            plot.Style.XMin = setup.RangeXMin.GetValue();
            plot.Style.XMax = setup.RangeXMax.GetValue();
            plot.Style.YMin = setup.RangeYMin.GetValue();
            plot.Style.YMax = setup.RangeYMax.GetValue();

            // Min/max of IM
            if (sourceMatrix != null)
            {
                if (setup.RangeYMin.Mode == EAxisRange.General)
                {
                    if (setup.RangeYMax.Mode == EAxisRange.General)
                    {
                        var range = sourceMatrix.AllValues.Range();
                        plot.Style.YMin = range.Min;
                        plot.Style.YMax = range.Max;
                    }
                    else
                    {
                        plot.Style.YMin = sourceMatrix.AllValues.Min();
                    }
                }
                else if (setup.RangeYMax.Mode == EAxisRange.General)
                {
                    plot.Style.YMax = sourceMatrix.AllValues.Max();
                }
            }

            switch (setup.RangeXMin.Mode)
            {
            case EAxisRange.Fixed:
                plot.Style.XMin = setup.RangeXMin.Value;
                break;

            case EAxisRange.Automatic:
            case EAxisRange.General:
                plot.Style.XMin = null;
                break;
            }


            //plot.Style.XMin = setup.RangeXMin.Get( toPlot );
            //plot.Style.XMax = setup.RangeXMax.Get( toPlot );
            //plot.Style.YMin = setup.RangeYMin.Get( toPlot );
            //plot.Style.YMax = setup.RangeYMax.Get( toPlot );

            return(plot);
        }