Example #1
0
        public void RefreshDisplay()
        {
            if (InputSimpleData.Count == 0) return;

            Series NewSerie = new System.Windows.Forms.DataVisualization.Charting.Series(base.InputSimpleData.Name);

            base.LabelAxisX = InputSimpleData[IdxDesc0].Name;
            if (this.InputSimpleData.Count <= IdxDesc1) IdxDesc1 = this.InputSimpleData.Count - 1;
            base.LabelAxisY = InputSimpleData[IdxDesc1].Name;

            NewSerie.ChartType = SeriesChartType.Point;

            double _MinY = double.MaxValue;
            double _MinX = double.MaxValue;
            double _MaxX = double.MinValue;
            double _MaxY = double.MinValue;

            double TmpMinX, TmpMinY, TmpMaxX, TmpMaxY;
            double TMp;

            double MinVolume = 0;
            double MaxVolume = 0;

            double MinColor = 0;
            double MaxColor = 0;

            if (this.IdxDescForMarkerSize >= 0)
            {
                MinVolume = this.InputSimpleData[this.IdxDescForMarkerSize].Min();
                MaxVolume = this.InputSimpleData[this.IdxDescForMarkerSize].Max();
            }
            if (this.IdxDescForMarkerColor >= 0)
            {
                MinColor = this.InputSimpleData[this.IdxDescForMarkerColor].Min();
                MaxColor = this.InputSimpleData[this.IdxDescForMarkerColor].Max();
            }

            cLUTProcess LUTProcess = new cLUTProcess(cGlobalInfo.GraphsLUT);

            for (int j = 0; j < this.InputSimpleData[0].Count; j++)
            {
                DataPoint DP = new DataPoint();

                TMp = this.InputSimpleData[IdxDesc0][j];
                if (TMp < _MinX) _MinX = TMp;
                else if (TMp > _MaxX) _MaxX = TMp;
                DP.XValue = TMp;

                double[] Value = new double[1];
                TMp = this.InputSimpleData[IdxDesc1][j];

                if (TMp < _MinY) _MinY = TMp;
                else if (TMp > _MaxY) _MaxY = TMp;

                Value[0] = TMp;
                DP.YValues = Value;
                if (this.IdxDescForMarkerSize < 0)
                    DP.MarkerSize = this.MarkerSize;
                else
                {
                    //   DP.MarkerSize = this.MarkerSize * 2;
                    int MarkerArea = (int)((50 * (this.InputSimpleData[this.IdxDescForMarkerSize][j] - MinVolume)) / (MaxVolume - MinVolume));
                    DP.MarkerSize = MarkerArea + this.MarkerSize;

                }

                DP.MarkerStyle = MarkerStyle.Circle;

                if (IsBorder)
                {
                    DP.MarkerBorderColor = Color.Black;
                    DP.MarkerBorderWidth = 1;
                }

                int IdxColor = j % LUTProcess.GetNumberOfColors();

                if (this.InputSimpleData.ListTags != null)
                {
                    if (j >= this.InputSimpleData.ListTags.Count) continue;
                    DP.Tag = this.InputSimpleData.ListTags[j];

                    if (DP.Tag.GetType() == typeof(cWell))
                    {
                        if (IdxDescForMarkerColor == -1) DP.Color = Color.FromArgb(this.Opacity, ((cWell)(DP.Tag)).GetClassColor());
                        DP.ToolTip = ((cWell)(DP.Tag)).GetShortInfo() + Value[0];
                    }
                    if (DP.Tag.GetType() == typeof(cSingleBiologicalObject))
                    {
                        if (IdxDescForMarkerColor == -1) DP.Color = Color.FromArgb(this.Opacity, ((cSingleBiologicalObject)(DP.Tag)).GetColor());
                        DP.ToolTip = ((cSingleBiologicalObject)(DP.Tag)).GetAssociatedPhenotype().Name + "\nValue: (" + DP.XValue.ToString("N2") + ":" + DP.YValues[0].ToString("N2") + ")";
                    }
                    if (DP.Tag.GetType() == typeof(cDescriptorType))
                    {
                        if (IdxDescForMarkerColor == -1) DP.Color = Color.FromArgb(this.Opacity, LUTProcess.GetColor(IdxColor));//((cWell)(DP.Tag)).GetClassColor();
                        DP.ToolTip = ((cDescriptorType)(DP.Tag)).GetShortInfo() + Value[0];
                        DP.AxisLabel = ((cDescriptorType)(DP.Tag)).GetName();
                        base.CurrentChartArea.AxisX.Interval = 1;
                    }
                    if (DP.Tag.GetType() == typeof(cPlate))
                    {
                        // DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                        if (IdxDescForMarkerColor == -1) DP.Color = Color.FromArgb(this.Opacity, LUTProcess.GetColor(IdxColor));
                        DP.ToolTip = ((cPlate)(DP.Tag)).GetName() + " : " + Value[0];
                        DP.AxisLabel = ((cPlate)(DP.Tag)).GetName();
                        base.CurrentChartArea.AxisX.Interval = 1;
                    }
                    if (DP.Tag.GetType() == typeof(string))
                    {
                        if (IdxDescForMarkerColor == -1) DP.Color = Color.FromArgb(this.Opacity, LUTProcess.GetColor(IdxColor)); ;
                        DP.ToolTip = (string)(DP.Tag);
                    }
                }

                if (IdxDescForMarkerColor != -1)
                {
                    int MarkerColor = (int)(((LUTProcess.GetNumberOfColors() - 1) * (this.InputSimpleData[this.IdxDescForMarkerColor][j] - MinColor)) / (MaxColor - MinColor));
                    DP.Color = Color.FromArgb(this.Opacity, LUTProcess.GetColor(MarkerColor));

                }
                //if (this.InputSimpleData[0].ListTags != null)
                //{
                //    if (j >= this.InputSimpleData[0].ListTags.Count) continue;
                //    DP.Tag = this.InputSimpleData[0].ListTags[j];

                //    if (DP.Tag.GetType() == typeof(cWell))
                //    {
                //        DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                //        DP.ToolTip = ((cWell)(DP.Tag)).GetShortInfo() + Value[0];
                //    }
                //    if (DP.Tag.GetType() == typeof(cSingleBiologicalObject))
                //    {
                //        DP.Color = ((cSingleBiologicalObject)(DP.Tag)).GetColor();
                //        DP.ToolTip = ((cSingleBiologicalObject)(DP.Tag)).GetAssociatedPhenotype().Name + "\nValue: (" + DP.XValue.ToString("N2") + ":" + DP.YValues[0].ToString("N2") + ")";
                //    }
                //    if (DP.Tag.GetType() == typeof(cDescriptorsType))
                //    {
                //        // DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                //        DP.ToolTip = ((cDescriptorsType)(DP.Tag)).GetShortInfo() + Value[0];
                //        DP.AxisLabel = ((cDescriptorsType)(DP.Tag)).GetName();
                //        base.CurrentChartArea.AxisX.Interval = 1;
                //    }
                //    if (DP.Tag.GetType() == typeof(cPlate))
                //    {
                //        // DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                //        DP.ToolTip = ((cPlate)(DP.Tag)).Name + " : " + Value[0];
                //        DP.AxisLabel = ((cPlate)(DP.Tag)).Name;
                //        base.CurrentChartArea.AxisX.Interval = 1;
                //    }
                //}
                NewSerie.Points.Add(DP);
            }

            base.CurrentSeries.Clear();
            base.CurrentSeries.Add(NewSerie);
            base.Run();

            if (_MinX == _MaxX) _MaxX = _MinX + 1;
            if (_MinY == _MaxY) _MaxY = _MinY + 1;

            base.ChartAreas[0].AxisX.Minimum = _MinX;
            base.ChartAreas[0].AxisY.Minimum = _MinY;

            base.ChartAreas[0].AxisX.Maximum = _MaxX;
            base.ChartAreas[0].AxisY.Maximum = _MaxY;

            if (IsDisplayTrendLine)
            {
                this.Series.Add("TrendLine");
                this.Series["TrendLine"].ChartType = SeriesChartType.Line;
                this.Series["TrendLine"].BorderWidth = 1;
                this.Series["TrendLine"].Color = Color.Red;
                string typeRegression = "Linear";//"Exponential";//
                string forecasting = "1";
                string error = "false";
                string forecastingError = "false";
                string parameters = typeRegression + ',' + forecasting + ',' + error + ',' + forecastingError;
                this.Series[0].Sort(PointSortOrder.Ascending, "X");
                this.DataManipulator.FinancialFormula(FinancialFormula.Forecasting, parameters, this.Series[0], this.Series["TrendLine"]);
            }

            base.CurrentTitle.Text = InputSimpleData.Name + " - " + base.LabelAxisX + " vs. " + base.LabelAxisY + " (" + this.InputSimpleData[0].Count + " points)";
        }
Example #2
0
        void Refresh()
        {
            base.CurrentSeries.Clear();
            double MaxY = 0;

            FinalMin = InputSimpleData.Min();
            FinalMax =  InputSimpleData.Max();
            for (int IdxSerie = 0; IdxSerie < InputSimpleData.Count; IdxSerie++)
            {
                Series NewSerie = new System.Windows.Forms.DataVisualization.Charting.Series(base.InputSimpleData[IdxSerie].Name);

                cLUTProcess LUTProcess = new cLUTProcess(cGlobalInfo.GraphsLUT);

                int IdxColor = IdxSerie % LUTProcess.GetNumberOfColors();
                NewSerie.Color = LUTProcess.GetColor(IdxColor);

                cHistogramBuilder HB = new cHistogramBuilder();
                HB.SetInputData(new cExtendedTable(InputSimpleData[IdxSerie]));
                HB.Min = FinalMin;
                HB.Max = FinalMax;
                if (this.BinNumber == -1)
                    HB.BinNumber = HB.Max - HB.Min +1 ;
                else
                    HB.BinNumber = this.BinNumber;

                HB.IsNormalized = this.IsHistoNormalized;
                if (this.IsHistoNormalized)
                {
                    base.LabelAxisY = "Normalized Frequency";
                    //base.CurrentChartArea.AxisY.Maximum = 1;
                }
                else
                    base.LabelAxisY = "Frequency";

                HB.Run();

                cExtendedTable CurrentHistogram = HB.GetOutPut();

                double TmpMax = CurrentHistogram[1].Max();
                if (TmpMax > MaxY) MaxY = TmpMax;

                if (IsPoint)
                    NewSerie.ChartType = SeriesChartType.Point;
                if (IsBar)
                    NewSerie.ChartType = SeriesChartType.Column;
                if (IsLine)
                    NewSerie.ChartType = SeriesChartType.Line;
                if (IsArea)
                    NewSerie.ChartType = SeriesChartType.Area;
                if (IsSpline)
                    NewSerie.ChartType = SeriesChartType.Spline;

                NewSerie.Tag = base.InputSimpleData[IdxSerie].Tag;

                for (int j = 0; j < CurrentHistogram[0].Count; j++)
                {
                    //this.chartForPoints.Series[0].Points[j].MarkerColor = Color.FromArgb(128, GlobalInfo.ListCellularPhenotypes[(int)MachineLearning.Classes[j]].ColourForDisplay);
                    DataPoint DP = new DataPoint();
                    double[] Value = new double[1];
                    Value[0] = CurrentHistogram[1][j];
                    DP.YValues = Value;
                    if (Value[0] == 0) continue;
                    DP.XValue = CurrentHistogram[0][j];
                    DP.Tag = base.InputSimpleData[IdxSerie].Tag;

                    // DP.MarkerSize = this.MarkerSize;
                    // DP.MarkerStyle = MarkerStyle.Circle;

                    if (IsBorder)
                    {
                        DP.MarkerBorderColor = Color.Black;
                        DP.MarkerBorderWidth = 1;
                      //  DP.BorderColor = Color.Black;
                      //  DP.BorderWidth = 1;
                    }
                    else
                    {
                        DP.BorderWidth = 0;
                        DP.MarkerBorderWidth = 0;
                    }

                    DP.Color = Color.FromArgb(this.Opacity, NewSerie.Color);
                        //    DP.MarkerStyle = MarkerStyle.Circle;
                        //    DP.MarkerSize = this.MarkerSize;
                       // }

                    DP.BorderWidth = 3;// this.LineWidth;

                    if (InputSimpleData[IdxSerie].Tag != null)
                    {
                         //if (j >= this.input[0].ListTags.Count) continue;

                        if (InputSimpleData[IdxSerie].Tag.GetType() == typeof(cWellClassType))
                         {
                             DP.Color = ((cWellClassType)(InputSimpleData[IdxSerie].Tag)).ColourForDisplay;
                             DP.ToolTip = ((cWellClassType)(InputSimpleData[IdxSerie].Tag)).Name + "\n";
                         }

                        //DP.Tag = this.input[0].ListTags[j];

                        //if (DP.Tag.GetType() == typeof(cWell))
                        //{
                        //    DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                        //    DP.ToolTip = ((cWell)(DP.Tag)).GetShortInfo() + Value[0];
                        //}
                        //if (DP.Tag.GetType() == typeof(cDescriptorsType))
                        //{
                        //    // DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                        //    DP.ToolTip = ((cDescriptorsType)(DP.Tag)).GetShortInfo() + Value[0];
                        //    DP.AxisLabel = ((cDescriptorsType)(DP.Tag)).GetName();
                        //    base.CurrentChartArea.AxisX.Interval = 1;

                        //}
                        //if (DP.Tag.GetType() == typeof(cPlate))
                        //{
                        //    // DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                        //    DP.ToolTip = ((cPlate)(DP.Tag)).Name + " : " + Value[0];
                        //    DP.AxisLabel = ((cPlate)(DP.Tag)).Name;
                        //    base.CurrentChartArea.AxisX.Interval = 1;

                        //}

                    }

                    DP.ToolTip += NewSerie.Name +"\n" + DP.XValue.ToString("N2") + " : " + DP.YValues[0];

                    NewSerie.Points.Add(DP);
                    //  if (Input[idxCol].ListTags != null)
                    //NewSerie.Points[IdxValue].Tag = Input[idxCol].ListTags[idxRow];
                    // if (this.IsDisplayValues) CurrentSeries.Points[IdxValue].Label = Value.ToString("N2");// string.Format("{0:0.###}", Math.Abs(Value));
                    //this.chartForPoints.Series[0].Points[j].MarkerBorderWidth = BorderSize;
                }
                base.CurrentSeries.Add(NewSerie);
            }

            base.CurrentChartArea.AxisY.Maximum = MaxY;

            base.Update();
        }
Example #3
0
        public void Run()
        {
            this.SliderForMarkerSize.trackBar.Value = this.MarkerSize;
            this.SliderForMarkerSize.numericUpDown.Value = this.MarkerSize;

            this.SliderForLineWidth.trackBar.Value = this.LineWidth;
            this.SliderForLineWidth.numericUpDown.Value = this.LineWidth;

            this.SliderForOpacity.numericUpDown.Maximum = this.SliderForOpacity.trackBar.Maximum = 255;
            this.SliderForOpacity.trackBar.Value = this.Opacity;
            this.SliderForOpacity.numericUpDown.Value = this.Opacity;

            if ((InputSimpleData==null)||((X_AxisValues != null) && (X_AxisValues.Count != InputSimpleData[0].Count))) return;
            if ((X_AxisValues != null) && (X_AxisValues.Min() <= 0) && (IsLogAxis)) return;

            #region multiple readouts
            if (ListCurves.Count > 0)
            {
                //for (int IdxSimpleReadoutCurve = 0; IdxSimpleReadoutCurve < input.Count; IdxSimpleReadoutCurve++)

                foreach (cCurveForGraph item in ListCurves)
                {
                    if (item == null) continue;
                    Series NewSerie = new System.Windows.Forms.DataVisualization.Charting.Series(item.Title);

                    //NewSerie.ChartType = SeriesChartType.ErrorBar;
                    NewSerie.ChartType = SeriesChartType.Point;

                //    NewSerie.ChartType = SeriesChartType.Point;

                    //NewSerie.ChartType = SeriesChartType.SplineRange;
                    NewSerie.ShadowOffset = 0;
                    //NewSerie.ShadowColor = Color.Transparent;

                    #region loop over the multireadouts curves
                    for (int j = 0; j < item.ListPtValues.Count; j++)
                    {
                        //this.chartForPoints.Series[0].Points[j].MarkerColor = Color.FromArgb(128, GlobalInfo.ListCellularPhenotypes[(int)MachineLearning.Classes[j]].ColourForDisplay);

                        cExtendedList ListValues = new cExtendedList();
                        for (int IdxValue = 1; IdxValue < item.ListPtValues[j].Count; IdxValue++)
                        {
                            ListValues.Add(item.ListPtValues[j][IdxValue]);
                        }

                        double[] Values = new double[2];

                        double Mean = ListValues.Mean();
                        double Std = ListValues.Std();

                        if (NewSerie.ChartType == SeriesChartType.ErrorBar)
                        {
                            Values = new double[3];
                            Values[0] = Mean;
                            Values[1] = Mean - Std;
                            Values[2] = Mean + Std;
                            DataPoint DP = new DataPoint();
                            DP.XValue = item.ListPtValues[j][0];
                            DP.YValues = Values;
                            DP.Color = Color.AliceBlue;
                            NewSerie.Points.Add(DP);
                        }
                        else if (NewSerie.ChartType == SeriesChartType.SplineRange)
                        {
                            Values[0] = Mean - Std;
                            Values[1] = Mean + Std;
                            DataPoint DP = new DataPoint();
                            DP.XValue = item.ListPtValues[j][0];
                            DP.YValues = Values;
                            DP.Color = Color.FromArgb(200, Color.Tomato);
                           // DP.MarkerSize = 10;
                            NewSerie.Points.Add(DP);
                        }
                        else
                        {
                           // Values = ListValues.ToArray();
                            for (int i = 0; i < ListValues.Count; i++)
                            {
                                 DataPoint DP = new DataPoint();
                                 DP.SetValueXY(item.ListPtValues[j][0], ListValues[i]);
                                 DP.Color = Color.FromArgb(190, Color.Tomato);
                                 DP.BorderColor = Color.Black;

                                 DP.BorderWidth = 1;
                                 DP.MarkerSize = 8;
                                 DP.MarkerStyle = MarkerStyle.Circle;
                                 NewSerie.Points.Add(DP);
                            }

                        }

                       // DP.Tag = DataSerie.Tag;
                        ////   Value[0] = item.ListPtValues[j];
                        //for (int IdxValue = 1; IdxValue < item.ListPtValues[j].Count; IdxValue++)
                        //{
                        //    ListValues.Add(item.ListPtValues[j][IdxValue]);
                        //}

                        //double[] Values = new double[2];
                        ////Values[0] = ListValues.Mean();
                        //double Mean = ListValues.Mean();
                        //double Std = ListValues.Std();
                        //Values[0] = Mean - Std;
                        //Values[1] = Mean + Std;

                        //DP.YValues = Values;

                        //if (IsBorder)
                        //{
                        //    DP.MarkerBorderColor = Color.Black;
                        //    DP.MarkerBorderWidth = 1;
                        //}

                        //if ((ArraySeriesInfo != null) && (ArraySeriesInfo[IdxSimpleReadoutCurve] != null))
                        //{
                        //    DP.Color = Color.FromArgb(this.Opacity, ArraySeriesInfo[IdxSimpleReadoutCurve].color);
                        //    NewSerie.Tag = ArraySeriesInfo[IdxSimpleReadoutCurve];
                        //    DP.MarkerStyle = ArraySeriesInfo[IdxSimpleReadoutCurve].markerStyle;
                        //    DP.MarkerSize = this.MarkerSize;
                        //}
                        //else
                       // {
                            //DP.MarkerStyle = MarkerStyle.Diamond;
                            // DP.MarkerSize = 4;
                       // }

                        // DP.BorderWidth = 2;

                        //if (item.ListPtValues[0].ListTags != null)
                        //{
                        //    if (j >= item.ListPtValues[0].ListTags.Count) continue;
                        //    DP.Tag = item.ListPtValues[0].ListTags[j];

                        //    if (DP.Tag.GetType() == typeof(cWell))
                        //    {
                        //        DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                        //        // DP.ToolTip = ((cWell)(DP.Tag)).GetShortInfo() + Value[0];
                        //    }
                        //    if (DP.Tag.GetType() == typeof(cDescriptorsType))
                        //    {
                        //        // DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                        //        //  DP.ToolTip = ((cDescriptorsType)(DP.Tag)).GetShortInfo() + Value[0];
                        //        DP.AxisLabel = ((cDescriptorsType)(DP.Tag)).GetName();
                        //        base.CurrentChartArea.AxisX.Interval = 1;

                        //    }
                        //    if (DP.Tag.GetType() == typeof(cPlate))
                        //    {
                        //        // DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                        //        //  DP.ToolTip = ((cPlate)(DP.Tag)).Name + " : " + Value[0];
                        //        DP.AxisLabel = ((cPlate)(DP.Tag)).Name;
                        //        base.CurrentChartArea.AxisX.Interval = 1;

                        //    }

                        //}
                        //NewSerie.Points.Add(DP);
                    }
                    #endregion

                    base.CurrentSeries.Add(NewSerie);
                }
            }

            if (base.ListInput != null)
            {
                foreach (cExtendedTable DataSerie in base.ListInput)
                {
                    Series NewSerie = new System.Windows.Forms.DataVisualization.Charting.Series("ComplexD_ataTable"+DataSerie.Name);
                    NewSerie.Tag = DataSerie.Tag;

                    //NewSerie.ChartType = SeriesChartType.SplineRange;
                    NewSerie.ChartType = SeriesChartType.ErrorBar;

                    for (int IdxPt = 0; IdxPt < DataSerie.Count; IdxPt++)
                    {
                        DataPoint DP = new DataPoint();
                        DP.XValue = DataSerie[IdxPt][0];

                        cExtendedList ListValues = new cExtendedList();
                        for (int i = 1; i < DataSerie[IdxPt].Count; i++)
                        {
                            ListValues.Add(DataSerie[IdxPt][i]);
                        }

                        if (ListValues.Count == 0) continue;
                        double[] Values = new double[2];

                        double Mean = ListValues.Mean();
                        double Std = ListValues.Std();
                        if (ListValues.Count == 1)
                            Std = 0;

                        if (NewSerie.ChartType == SeriesChartType.ErrorBar)
                        {
                            Values = new double[3];
                            Values[0] = Mean;
                            Values[1] = Mean - Std;
                            Values[2] = Mean + Std;
                        }
                        else
                        {
                            Values[0] = Mean - Std;
                            Values[1] = Mean + Std;
                        }
                        DP.YValues = Values;
                        DP.Tag = DataSerie.Tag;

                        DP.ToolTip = "Mean: " + Mean + "\nStdev: " + Std;

                        if (DP.Tag.GetType() == typeof(cWellClassType))
                        {
                            DP.Color = Color.FromArgb(200, ((cWellClassType)(DP.Tag)).ColourForDisplay);
                        }
                        //if (DP.Tag.GetType() == typeof(cWell))
                        //{
                        //    DP.Color = ((cWell)(DP.Tag)).GetClassColor();

                        //}
                       // DP.Color = Color.FromArgb(200, Color.Tomato);

                        NewSerie.Points.Add(DP);
                    }

                    base.CurrentSeries.Add(NewSerie);

                }

            }

            #endregion

            #region simple readout curves
            if (InputSimpleData != null)
            {
                cLUTProcess LUTProcess = new cLUTProcess(cGlobalInfo.GraphsLUT);

                for (int IdxSimpleReadoutCurve = 0; IdxSimpleReadoutCurve < InputSimpleData.Count; IdxSimpleReadoutCurve++)
                {
                    Series NewSerie = new System.Windows.Forms.DataVisualization.Charting.Series(base.InputSimpleData[IdxSimpleReadoutCurve].Name);
                    NewSerie.Tag = base.InputSimpleData[IdxSimpleReadoutCurve].Tag;

                    if (ISPoint)
                        NewSerie.ChartType = SeriesChartType.Point;
                    if (ISFastPoint)
                        NewSerie.ChartType = SeriesChartType.FastPoint;
                    if (IsLine)
                        NewSerie.ChartType = SeriesChartType.Line;
                    if (IsBar)
                        NewSerie.ChartType = SeriesChartType.Column;

                    if ((ArraySeriesInfo != null) && (ArraySeriesInfo[IdxSimpleReadoutCurve] != null))
                    {
                        NewSerie.ChartType = SeriesChartType.Spline;
                        //NewSerie.ChartType = SeriesChartType.Line;
                    }

                    #region loop over the simple readout curves
                    for (int j = 0; j < this.InputSimpleData[IdxSimpleReadoutCurve].Count; j++)
                    {
                        //this.chartForPoints.Series[0].Points[j].MarkerColor = Color.FromArgb(128, GlobalInfo.ListCellularPhenotypes[(int)MachineLearning.Classes[j]].ColourForDisplay);
                        DataPoint DP = new DataPoint();
                        double[] Value = new double[1];
                        Value[0] = this.InputSimpleData[IdxSimpleReadoutCurve][j];
                        if (double.IsNaN(Value[0])) continue;
                        DP.YValues = Value;

                        if (X_AxisValues != null)
                            DP.XValue = X_AxisValues[j];
                        else
                            DP.XValue = j;

                      //  DP.AxisLabel = this.InputSimpleData.ListRowNames[j].ToString();

                        if (IsBorder)
                        {
                            DP.MarkerBorderColor = Color.Black;
                            DP.MarkerBorderWidth = 0;// 1;
                        }

                        if ((ArraySeriesInfo != null) && (ArraySeriesInfo[IdxSimpleReadoutCurve] != null))
                        {
                            DP.Color = Color.FromArgb(this.Opacity, ArraySeriesInfo[IdxSimpleReadoutCurve].color);
                            NewSerie.Tag = ArraySeriesInfo[IdxSimpleReadoutCurve];
                            DP.MarkerStyle = ArraySeriesInfo[IdxSimpleReadoutCurve].markerStyle;
                            DP.MarkerSize = this.MarkerSize;
                        }
                        else
                        {
                            int IdxColor = IdxSimpleReadoutCurve % LUTProcess.GetNumberOfColors();
                            NewSerie.Color = LUTProcess.GetColor(IdxColor);
                            DP.Color = Color.FromArgb(this.Opacity, LUTProcess.GetColor(IdxColor));
                            DP.MarkerStyle = MarkerStyle.Circle;
                            DP.MarkerSize = this.MarkerSize;
                        }

                        DP.BorderWidth = this.LineWidth;

                        if (this.InputSimpleData[IdxSimpleReadoutCurve].ListTags != null)
                        {
                            if (j >= this.InputSimpleData[IdxSimpleReadoutCurve].ListTags.Count)
                            {
                                DP.Tag = this.InputSimpleData[IdxSimpleReadoutCurve];
                                NewSerie.Points.Add(DP);

                                continue;
                            }
                            DP.Tag = this.InputSimpleData[IdxSimpleReadoutCurve].ListTags[j];

                            if (DP.Tag.GetType() == typeof(string))
                            {
                                DP.ToolTip = (string)(DP.Tag);
                            }

                            if (DP.Tag.GetType() == typeof(cWellClassType))
                            {
                                DP.Color = ((cWellClassType)(DP.Tag)).ColourForDisplay;
                                DP.ToolTip = ((cWellClassType)(DP.Tag)).GetShortInfo() + Value[0];
                                //  DP.AxisLabel = ((cWellClass)(DP.Tag)).Name;
                                base.CurrentChartArea.AxisX.Interval = 1;

                                if (this.InputSimpleData.ListRowNames != null)
                                    DP.AxisLabel = this.InputSimpleData.ListRowNames[j];

                            }
                            if (DP.Tag.GetType() == typeof(cWell))
                            {
                                DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                                DP.ToolTip = ((cWell)(DP.Tag)).GetShortInfo() + Value[0];

                                if ((this.InputSimpleData.ListRowNames != null) && (j < this.InputSimpleData.ListRowNames.Count))
                                    DP.AxisLabel = this.InputSimpleData.ListRowNames[j];
                            }
                            if (DP.Tag.GetType() == typeof(cDescriptorType))
                            {
                                // DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                                DP.ToolTip = ((cDescriptorType)(DP.Tag)).GetShortInfo() + Value[0];
                                DP.AxisLabel = ((cDescriptorType)(DP.Tag)).GetName();
                                base.CurrentChartArea.AxisX.Interval = 1;

                            }
                            if (DP.Tag.GetType() == typeof(cPlate))
                            {
                                // DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                                DP.ToolTip = ((cPlate)(DP.Tag)).GetName() + " : " + Value[0];
                                DP.AxisLabel = ((cPlate)(DP.Tag)).GetName();
                                base.CurrentChartArea.AxisX.Interval = 1;
                            }
                        }
                        NewSerie.Points.Add(DP);
                    }
                    #endregion

                    base.CurrentSeries.Add(NewSerie);
                }
            }
            #endregion

            base.Run();
            base.ChartAreas[0].AxisX.IsLogarithmic = IsLogAxis;
        }
Example #4
0
        void Chart_CustomizeLegend(object sender, CustomizeLegendEventArgs e)
        {
            e.LegendItems.Clear();
            int IdxSerie = 0;
            foreach (var item in this.Series)
            {
                if (item.Name.Contains("ComplexD_ataTable")) continue;
                if (item.Name == "TrendLine") continue;

                //if (item.Tag != null)
                //{
                LegendItem newItem = new LegendItem();
                newItem.ImageStyle = LegendImageStyle.Marker;
                newItem.MarkerStyle = MarkerStyle.Square;
                newItem.MarkerSize = 8;
                newItem.ShadowColor = Color.Black;
                newItem.ShadowOffset = 1;

                if (item.Tag != null)
                {
                    if (item.Tag.GetType() == typeof(cWellClassType))
                        newItem.MarkerBorderColor = newItem.MarkerColor = ((cWellClassType)(item.Tag)).ColourForDisplay;
                    else if (item.Tag.GetType() == typeof(cCellularPhenotype))
                        newItem.MarkerBorderColor = newItem.MarkerColor = ((cCellularPhenotype)(item.Tag)).ColourForDisplay;
                    else
                        newItem.MarkerBorderColor = newItem.MarkerColor= item.Color;
                }
                else
                {
                    cLUTProcess LUTProcess = new cLUTProcess(cGlobalInfo.GraphsLUT);

                    int IdxColor = IdxSerie % LUTProcess.GetNumberOfColors();
                    newItem.MarkerBorderColor = newItem.MarkerColor = LUTProcess.GetColor(IdxColor);
                }

                newItem.Cells.Add(LegendCellType.SeriesSymbol, "", ContentAlignment.MiddleLeft);
                newItem.Cells.Add(LegendCellType.Text, item.Name, ContentAlignment.MiddleLeft);
                e.LegendItems.Add(newItem);
                IdxSerie++;
                //}
            }
        }