Пример #1
0
        public PlateChart BuildChart(int IdxDescriptor, double[] MinMax)
        {
            if (Parent.GlobalInfo.IsDisplayClassOnly) return BuildChartForClass();

            int borderSize = 8;
            int GutterSize = (int)Parent.GlobalInfo.OptionsWindow.numericUpDownGutter.Value;

            if (AssociatedChart != null) AssociatedChart.Dispose();
            if (IdxDescriptor >= ListDescriptors.Count) return null;
            CurrentDescriptorToDisplay = IdxDescriptor;
            AssociatedChart = new PlateChart();
            Series CurrentSeries = new Series("ChartSeries" + PosX + "x" + PosY);
            ChartArea CurrentChartArea = new ChartArea("ChartArea" + PosX + "x" + PosY);

            CurrentChartArea.Axes[0].MajorGrid.Enabled = false;
            CurrentChartArea.Axes[0].LabelStyle.Enabled = false;

            if ((ListDescriptors[IdxDescriptor].GetAssociatedType().GetBinNumber() == 1) || (Parent.GlobalInfo.OptionsWindow.radioButtonDisplayAverage.Checked))
            {
                CurrentChartArea.Axes[1].LabelStyle.Enabled = false;
                CurrentChartArea.Axes[1].MajorGrid.Enabled = false;
                CurrentChartArea.Axes[0].Enabled = AxisEnabled.False;
                CurrentChartArea.Axes[1].Enabled = AxisEnabled.False;

                int ConvertedValue;

                byte[][] LUT = Parent.GlobalInfo.LUT_JET;

                if (MinMax[0] == MinMax[1])
                    ConvertedValue = 0;
                else
                    ConvertedValue = (int)(((ListDescriptors[IdxDescriptor].GetValue() - MinMax[0]) * (LUT[0].Length - 1)) / (MinMax[1] - MinMax[0]));
                if ((ConvertedValue >= 0) && (ConvertedValue < LUT[0].Length))
                    CurrentChartArea.BackColor = Color.FromArgb(LUT[0][ConvertedValue], LUT[1][ConvertedValue], LUT[2][ConvertedValue]);
                AssociatedChart.ChartAreas.Add(CurrentChartArea);
            }
            else
            {
                CurrentSeries.ChartType = SeriesChartType.Line;
                for (int IdxValue = 0; IdxValue < ListDescriptors[IdxDescriptor].GetAssociatedType().GetBinNumber(); IdxValue++)
                    CurrentSeries.Points.Add(ListDescriptors[IdxDescriptor].Getvalue(IdxValue));

                CurrentChartArea.Axes[1].MajorGrid.Enabled = false;
                CurrentChartArea.Axes[1].MajorGrid.LineColor = Color.FromArgb(127, 127, 127);
                CurrentChartArea.Axes[1].LineColor = Color.FromArgb(127, 127, 127);
                CurrentChartArea.Axes[1].MajorTickMark.LineColor = Color.FromArgb(127, 127, 127);
                CurrentChartArea.Axes[1].LabelStyle.Enabled = false;
                CurrentChartArea.Axes[0].LineColor = Color.FromArgb(127, 127, 127);
                CurrentChartArea.Axes[0].MajorTickMark.LineColor = Color.FromArgb(127, 127, 127);
                CurrentSeries.Color = Color.White;
                CurrentSeries.BorderWidth = 1;
                CurrentChartArea.BackColor = Color.FromArgb(16, 37, 63);

                CurrentChartArea.BorderWidth = borderSize;
                AssociatedChart.ChartAreas.Add(CurrentChartArea);
            }

            AssociatedChart.Location = new System.Drawing.Point((int)((PosX - 1) * (Parent.GlobalInfo.SizeHistoWidth + GutterSize) + Parent.GlobalInfo.ShiftX), (int)((PosY - 1) * (Parent.GlobalInfo.SizeHistoHeight + GutterSize) + Parent.GlobalInfo.ShiftY));
            AssociatedChart.Series.Add(CurrentSeries);

            AssociatedChart.BackColor = CurrentColor;
            AssociatedChart.Width = (int)Parent.GlobalInfo.SizeHistoWidth;
            AssociatedChart.Height = (int)Parent.GlobalInfo.SizeHistoHeight;

            if (Parent.GlobalInfo.OptionsWindow.checkBoxDisplayWellInformation.Checked)
            {
                Title MainLegend = new Title();

                if (Parent.GlobalInfo.OptionsWindow.radioButtonWellInfoName.Checked)
                    MainLegend.Text = Name;
                if (Parent.GlobalInfo.OptionsWindow.radioButtonWellInfoInfo.Checked)
                    MainLegend.Text = Info;
                if (Parent.GlobalInfo.OptionsWindow.radioButtonWellInfoLocusID.Checked)
                    MainLegend.Text = ((int)(LocusID)).ToString();
                if (Parent.GlobalInfo.OptionsWindow.radioButtonWellInfoConcentration.Checked)
                    if(Concentration>=0) MainLegend.Text = Concentration.ToString("e4");

                MainLegend.Docking = Docking.Bottom;
                MainLegend.Font = new System.Drawing.Font("Arial", Parent.GlobalInfo.SizeHistoWidth / 10 + 1, FontStyle.Regular);
                MainLegend.BackColor = MainLegend.BackImageTransparentColor;

                AssociatedChart.Titles.Add(MainLegend);
            }
            AssociatedChart.Update();
            AssociatedChart.Show();
            AssociatedChart.MouseClick += new System.Windows.Forms.MouseEventHandler(this.AssociatedChart_MouseClick);
            AssociatedChart.GetToolTipText += new System.EventHandler<ToolTipEventArgs>(this.AssociatedChart_GetToolTipText);
            return this.AssociatedChart;
        }
Пример #2
0
        public PlateChart BuildChartForClass()
        {
            if (AssociatedChart != null) AssociatedChart.Dispose();
            AssociatedChart = new PlateChart();
            Series CurrentSeries = new Series("ChartSeries" + PosX + "x" + PosY);
            ChartArea CurrentChartArea = new ChartArea("ChartArea" + PosX + "x" + PosY);

            CurrentChartArea.Axes[0].MajorGrid.Enabled = false;
            CurrentChartArea.Axes[0].LabelStyle.Enabled = false;

            CurrentChartArea.Axes[1].LabelStyle.Enabled = false;
            CurrentChartArea.Axes[1].MajorGrid.Enabled = false;
            CurrentChartArea.Axes[0].Enabled = AxisEnabled.False;
            CurrentChartArea.Axes[1].Enabled = AxisEnabled.False;

            CurrentChartArea.BackColor = CurrentColor; //Color.FromArgb(LUT[0][ConvertedValue], LUT[1][ConvertedValue], LUT[2][ConvertedValue]);
            AssociatedChart.ChartAreas.Add(CurrentChartArea);
            //AssociatedChart.Location = new System.Drawing.Point((PosX - 1) * (Parent.SizeHistoWidth + Parent.GutterSize), (PosY - 1) * (Parent.SizeHistoHeight + Parent.GutterSize));
            //AssociatedChart.Series.Add(CurrentSeries);

            int GutterSize = (int)Parent.GlobalInfo.OptionsWindow.numericUpDownGutter.Value;

            AssociatedChart.Location = new System.Drawing.Point((int)((PosX - 1) * (Parent.GlobalInfo.SizeHistoWidth + GutterSize) + Parent.GlobalInfo.ShiftX), (int)((PosY - 1) * (Parent.GlobalInfo.SizeHistoHeight + GutterSize) + Parent.GlobalInfo.ShiftY));
            AssociatedChart.Series.Add(CurrentSeries);

            AssociatedChart.BackColor = CurrentColor;
            AssociatedChart.Width = (int)Parent.GlobalInfo.SizeHistoWidth;
            AssociatedChart.Height = (int)Parent.GlobalInfo.SizeHistoHeight;

            if (Parent.GlobalInfo.OptionsWindow.checkBoxDisplayWellInformation.Checked)
            {
                Title MainLegend = new Title();

                if (Parent.GlobalInfo.OptionsWindow.radioButtonWellInfoName.Checked)
                    MainLegend.Text = Name;
                if (Parent.GlobalInfo.OptionsWindow.radioButtonWellInfoInfo.Checked)
                    MainLegend.Text = Info;
                if (Parent.GlobalInfo.OptionsWindow.radioButtonWellInfoLocusID.Checked)
                    MainLegend.Text = ((int)(LocusID)).ToString();
                if (Parent.GlobalInfo.OptionsWindow.radioButtonWellInfoConcentration.Checked)
                {
                    if(Concentration>=0)
                    MainLegend.Text = Concentration.ToString("e4");
                }

                MainLegend.Docking = Docking.Bottom;
                MainLegend.Font = new System.Drawing.Font("Arial", Parent.GlobalInfo.SizeHistoWidth / 10 + 1, FontStyle.Regular);
                MainLegend.BackColor = MainLegend.BackImageTransparentColor;

                AssociatedChart.Titles.Add(MainLegend);
            }
            AssociatedChart.Update();
            AssociatedChart.Show();
            AssociatedChart.MouseClick += new System.Windows.Forms.MouseEventHandler(this.AssociatedChart_MouseClick);
            AssociatedChart.GetToolTipText += new System.EventHandler<ToolTipEventArgs>(this.AssociatedChart_GetToolTipText);
            return this.AssociatedChart;
        }
Пример #3
0
        public PlateChart BuildChart(int IdxDescriptor, double[] MinMax)
        {
            if (Parent.GlobalInfo.IsDisplayClassOnly) return BuildChartForClass();

            int borderSize = 8;
            int GutterSize = (int)Parent.GlobalInfo.OptionsWindow.numericUpDownGutter.Value;

            if (AssociatedChart != null) AssociatedChart.Dispose();
            if (IdxDescriptor >= ListDescriptors.Count) return null;
            CurrentDescriptorToDisplay = IdxDescriptor;
            AssociatedChart = new PlateChart();
            Series CurrentSeries = new Series("ChartSeries" + PosX + "x" + PosY);
            ChartArea CurrentChartArea = new ChartArea("ChartArea" + PosX + "x" + PosY);

            CurrentChartArea.Axes[0].MajorGrid.Enabled = false;
            CurrentChartArea.Axes[0].LabelStyle.Enabled = false;

            if (Parent.GlobalInfo.ViewMode == eViewMode.PIE)
            {
                CurrentSeries.ChartType = SeriesChartType.Pie;
                //AssociatedChart.Palette = ChartColorPalette.Grayscale;
                //ChartColorPalette a = new ChartColorPalette();

                for (int IdxValue = 0; IdxValue < ListDescriptors.Count; IdxValue++)
                {
                    if (ListDescriptors[IdxValue].GetAssociatedType().IsActive())
                    {
                        CurrentSeries.Points.Add(ListDescriptors[IdxValue].GetValue());
                        //CurrentSeries.Points[Idx].Label = String.Format("{0:0.###}", ((100.0 * ListPathway[Idx].Occurence) / TotalOcurrence)) + " %";

                        //CurrentSeries.Points[Idx].LegendText = ListPathway[Idx].Name;
                        //CurrentSeries.Points[CurrentSeries.Points.Count - 1] = 2;
                        //CurrentSeries.Points[CurrentSeries.Points.Count - 1].Label = ListDescriptors[IdxValue].GetAssociatedType().GetName() + " : ";
                    }
                }
                //CurrentChartArea.Axes[1].MajorGrid.Enabled = false;
                //CurrentChartArea.Axes[1].MajorGrid.LineColor = Color.FromArgb(127, 127, 127);
                //CurrentChartArea.Axes[1].LineColor = Color.FromArgb(127, 127, 127);
                //CurrentChartArea.Axes[1].MajorTickMark.LineColor = Color.FromArgb(127, 127, 127);
                //CurrentChartArea.Axes[1].LabelStyle.Enabled = false;
                //CurrentChartArea.Axes[0].LineColor = Color.FromArgb(127, 127, 127);
                //CurrentChartArea.Axes[0].MajorTickMark.LineColor = Color.FromArgb(127, 127, 127);
                //CurrentSeries.Color = Color.White;
                //CurrentSeries.BorderWidth = 1;
                //CurrentChartArea.BackColor = Color.FromArgb(16, 37, 63);

                //CurrentChartArea.BorderWidth = borderSize;
                AssociatedChart.ChartAreas.Add(CurrentChartArea);
            }
            else if ((ListDescriptors[IdxDescriptor].GetAssociatedType().GetBinNumber() == 1) || (Parent.GlobalInfo.ViewMode == eViewMode.AVERAGE))
            {
                CurrentChartArea.Axes[1].LabelStyle.Enabled = false;
                CurrentChartArea.Axes[1].MajorGrid.Enabled = false;
                CurrentChartArea.Axes[0].Enabled = AxisEnabled.False;
                CurrentChartArea.Axes[1].Enabled = AxisEnabled.False;

                int ConvertedValue;

                byte[][] LUT = Parent.GlobalInfo.LUT;

                if (MinMax[0] == MinMax[1])
                    ConvertedValue = 0;
                else
                    ConvertedValue = (int)(((ListDescriptors[IdxDescriptor].GetValue() - MinMax[0]) * (LUT[0].Length - 1)) / (MinMax[1] - MinMax[0]));
                if ((ConvertedValue >= 0) && (ConvertedValue < LUT[0].Length))
                    CurrentChartArea.BackColor = Color.FromArgb(LUT[0][ConvertedValue], LUT[1][ConvertedValue], LUT[2][ConvertedValue]);
                AssociatedChart.ChartAreas.Add(CurrentChartArea);
            }
            else
            {
                CurrentSeries.ChartType = SeriesChartType.Column;

                for (int IdxValue = 0; IdxValue < ListDescriptors[IdxDescriptor].Histogram.GetXvalues().Count; IdxValue++)
                {
                    if ((Parent.GlobalInfo.OptionsWindow.radioButtonHistoDisplayAutomatedMinMax.Checked) || (Parent.GlobalInfo.OptionsWindow.radioButtonHistoDisplayManualMinMax.Checked))
                    {
                        CurrentSeries.Points.AddXY(ListDescriptors[IdxDescriptor].GetHistoXvalue(IdxValue), ListDescriptors[IdxDescriptor].GetHistovalue(IdxValue));
                    }
                    else
                    {
                        CurrentSeries.Points.Add(ListDescriptors[IdxDescriptor].GetHistovalue(IdxValue));
                    }
                }

                CurrentChartArea.Axes[1].MajorGrid.Enabled = false;
                CurrentChartArea.Axes[1].MajorGrid.LineColor = Color.FromArgb(127, 127, 127);
                CurrentChartArea.Axes[1].LineColor = Color.FromArgb(127, 127, 127);
                CurrentChartArea.Axes[1].MajorTickMark.LineColor = Color.FromArgb(127, 127, 127);
                CurrentChartArea.Axes[1].LabelStyle.Enabled = false;
                CurrentChartArea.Axes[0].LineColor = Color.FromArgb(127, 127, 127);
                CurrentChartArea.Axes[0].MajorTickMark.LineColor = Color.FromArgb(127, 127, 127);
                if (Parent.GlobalInfo.OptionsWindow.radioButtonHistoDisplayAutomatedMinMax.Checked)
                {
                    CurrentChartArea.Axes[0].Minimum = Parent.GetCurrentDisplayPlate().MinMaxHisto[0];
                    CurrentChartArea.Axes[0].Maximum = Parent.GetCurrentDisplayPlate().MinMaxHisto[1];
                }
                else if (Parent.GlobalInfo.OptionsWindow.radioButtonHistoDisplayManualMinMax.Checked)
                {
                    CurrentChartArea.Axes[0].Minimum = (double)Parent.GlobalInfo.OptionsWindow.numericUpDownManualMin.Value;
                    CurrentChartArea.Axes[0].Maximum = (double)Parent.GlobalInfo.OptionsWindow.numericUpDownManualMax.Value;
                }
                CurrentSeries.Color = Color.White;
                CurrentSeries.BorderWidth = 1;
                CurrentChartArea.BackColor = Color.FromArgb(16, 37, 63);

                CurrentChartArea.BorderWidth = borderSize;
                AssociatedChart.ChartAreas.Add(CurrentChartArea);
            }

            AssociatedChart.Location = new System.Drawing.Point((int)((PosX - 1) * (Parent.GlobalInfo.SizeHistoWidth + GutterSize) + Parent.GlobalInfo.ShiftX), (int)((PosY - 1) * (Parent.GlobalInfo.SizeHistoHeight + GutterSize) + Parent.GlobalInfo.ShiftY));
            AssociatedChart.Series.Add(CurrentSeries);

            AssociatedChart.BackColor = CurrentColor;
            AssociatedChart.Width = (int)Parent.GlobalInfo.SizeHistoWidth;
            AssociatedChart.Height = (int)Parent.GlobalInfo.SizeHistoHeight;

            if ((Parent.GlobalInfo.OptionsWindow.checkBoxDisplayWellInformation.Checked) && (Parent.GlobalInfo.ViewMode != eViewMode.PIE))
            {
                Title MainLegend = new Title();

                if (Parent.GlobalInfo.OptionsWindow.radioButtonWellInfoName.Checked)
                    MainLegend.Text = Name;
                if (Parent.GlobalInfo.OptionsWindow.radioButtonWellInfoInfo.Checked)
                    MainLegend.Text = Info;
                if (Parent.GlobalInfo.OptionsWindow.radioButtonWellInfoDescValue.Checked)
                    MainLegend.Text = ListDescriptors[Parent.ListDescriptors.CurrentSelectedDescriptor].GetValue().ToString("N3");
                if (Parent.GlobalInfo.OptionsWindow.radioButtonWellInfoLocusID.Checked)
                    MainLegend.Text = ((int)(LocusID)).ToString();
                if (Parent.GlobalInfo.OptionsWindow.radioButtonWellInfoConcentration.Checked)
                    if (Concentration >= 0) MainLegend.Text = Concentration.ToString("e4");

                MainLegend.Docking = Docking.Bottom;
                MainLegend.Font = new System.Drawing.Font("Arial", Parent.GlobalInfo.SizeHistoWidth / 10 + 1, FontStyle.Regular);
                MainLegend.BackColor = MainLegend.BackImageTransparentColor;

                AssociatedChart.Titles.Add(MainLegend);
            }
            AssociatedChart.Update();
            AssociatedChart.Show();
            AssociatedChart.MouseClick += new System.Windows.Forms.MouseEventHandler(this.AssociatedChart_MouseClick);
            AssociatedChart.GetToolTipText += new System.EventHandler<ToolTipEventArgs>(this.AssociatedChart_GetToolTipText);
            return this.AssociatedChart;
        }