void RedrawPie() { this.Series.Clear(); Series NewSerie = new Series(Input.Name); NewSerie.ChartType = SeriesChartType.Pie; cHistogramBuilder HB = new cHistogramBuilder(); HB.SetInputData(this.Input); HB.BinNumber = 1; HB.Run(); cExtendedTable CurrentHistogram = HB.GetOutPut(); 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); //double[] Value = new double[1]; //Value[0] = CurrentHistogram[1][j]; // if (Value[0] == 0) continue; NewSerie.Points.Add(CurrentHistogram[1][j]); DataPoint DP = new DataPoint(); // SeriesPos[i].Points.AddXY(MinValue + ((MaxValue - MinValue) * IdxValue) / Max, HistoPos[i][1][IdxValue]); //DP.SetValueXY(Step * j + GlobalMinX, Value[0]); //double[] Value = new double[1]; //Value[0] = CurrentHistogram[1][j]; // DP.YValues = Value; // if (Value[0] == 0) continue; // DP.XValue = Step * j + GlobalMinX; //DP.Tag = InputSimpleData[IdxSerie].Tag; } //cExtendedTable CurrentHistogram = HB.GetOutPut(); this.Series.Add(NewSerie); }
void Refresh() { base.CurrentSeries.Clear(); double GlobalMinX = 0; double GlobalMaxX = 0; if (this.SliderForMarkerSizeBinSize.radioButtonMinMaxAutomated.Checked) { GlobalMinX = this.InputSimpleData.Min(); GlobalMaxX = this.InputSimpleData.Max(); } else { GlobalMinX = (double)this.SliderForMarkerSizeBinSize.numericUpDownMin.Value; GlobalMaxX = (double)this.SliderForMarkerSizeBinSize.numericUpDownMax.Value; } for (int IdxSerie = 0; IdxSerie < InputSimpleData.Count; IdxSerie++) { if (InputSimpleData[IdxSerie].Count == 0) continue; Series NewSerie = new System.Windows.Forms.DataVisualization.Charting.Series(base.InputSimpleData[IdxSerie].Name + "_Histogram"); NewSerie.Tag = base.InputSimpleData[IdxSerie].Tag; cHistogramBuilder HB = new cHistogramBuilder(); HB.SetInputData(new cExtendedTable(InputSimpleData[IdxSerie])); if (this.SliderForMarkerSizeBinSize.radioButtonMinMaxAutomated.Checked) { HB.Min = GlobalMinX; HB.Max = GlobalMaxX; } else { HB.Min = (double)this.SliderForMarkerSizeBinSize.numericUpDownMin.Value; HB.Max = (double)this.SliderForMarkerSizeBinSize.numericUpDownMax.Value; } HB.IsBinNumberMode = this.SliderForMarkerSizeBinSize.radioButtonBinNumber.Checked; HB.BinSize = (double)this.SliderForMarkerSizeBinSize.numericUpDownBinSize.Value; if(this.BinNumber==-1) HB.BinNumber = HB.Max - HB.Min+1; else HB.BinNumber = this.BinNumber; HB.Run(); CurrentHistogram = HB.GetOutPut(); //if (ISPoint) // NewSerie.ChartType = SeriesChartType.Point; //if (IsLine) // NewSerie.ChartType = SeriesChartType.Line; //if (IsBar) // NewSerie.ChartType = SeriesChartType.Column; //NewSerie.ChartType = SeriesChartType.StackedColumn; if (this.Is100) { NewSerie.ChartType = SeriesChartType.StackedColumn100; base.LabelAxisY = "Frequency %"; base.CurrentChartArea.AxisY.Minimum = 0; base.CurrentChartArea.AxisY.Maximum = 100; } else { NewSerie.ChartType = SeriesChartType.StackedColumn; base.LabelAxisY = "Frequency"; base.CurrentChartArea.AxisY.Minimum = Double.NaN; base.CurrentChartArea.AxisY.Maximum = Double.NaN; // base.CurrentChartArea.AxisY. } //SeriesPos[i].ChartType = SeriesChartType.StackedColumn; // double Step = (GlobalMaxX - GlobalMinX + 1) / CurrentHistogram[0].Count; for (int j = 0; j < CurrentHistogram[0].Count; j++) { double[] Value = new double[1]; Value[0] = CurrentHistogram[1][j]; DataPoint DP = new DataPoint(); DP.SetValueXY(/*Step * j + GlobalMinX*/ CurrentHistogram[0][j], Value[0]); DP.Tag = InputSimpleData[IdxSerie].Tag; if (IsBorder) { DP.MarkerBorderColor = Color.Black; DP.MarkerBorderWidth = 1; DP.BorderColor = Color.Black; DP.BorderWidth = 1; } else { DP.BorderWidth = 0; DP.MarkerBorderWidth = 0; } if (InputSimpleData[IdxSerie].Tag != null) { if (InputSimpleData[IdxSerie].Tag.GetType() == typeof(cWellClassType)) { DP.Color = ((cWellClassType)(InputSimpleData[IdxSerie].Tag)).ColourForDisplay; DP.ToolTip = ((cWellClassType)(InputSimpleData[IdxSerie].Tag)).Name + "\n"; } if (InputSimpleData[IdxSerie].Tag.GetType() == typeof(cCellularPhenotype)) { DP.Color = ((cCellularPhenotype)(InputSimpleData[IdxSerie].Tag)).ColourForDisplay; DP.ToolTip = ((cCellularPhenotype)(InputSimpleData[IdxSerie].Tag)).Name + "\n"; } } DP.ToolTip += DP.XValue.ToString("N2") + " :\n" + DP.YValues[0]; NewSerie.Points.Add(DP); } base.CurrentSeries.Add(NewSerie); } // base.LabelAxisY = "Frequency"; base.Update(); }
private void histogramsToolStripMenuItem_Click(object sender, EventArgs e) { cGUI_ListClasses GUIClasses = new cGUI_ListClasses(); GUIClasses.IsCheckBoxes = false; GUIClasses.ClassType = eClassType.PHENOTYPE; if (!GUIClasses.Run().IsSucceed) return; cGUI_ListClasses GUIClassesWells = new cGUI_ListClasses(); GUIClassesWells.IsCheckBoxes = true; GUIClassesWells.ClassType = eClassType.WELL; if (!GUIClassesWells.Run().IsSucceed) return; List<cWellClassType> ListClass = new List<cWellClassType>(); for (int i = 0; i < GUIClassesWells.GetOutPut()[0].Count; i++) { if (GUIClassesWells.GetOutPut()[0][i] == 1) ListClass.Add(cGlobalInfo.ListWellClasses[i]); } cGUI_ListPlates GUIListPlates = new cGUI_ListPlates(); GUIListPlates.IsCheckBoxes = true; if (!GUIListPlates.Run().IsSucceed) return; List<cDescriptorType> LCDT = new List<cDescriptorType>(); LCDT.Add(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor()); cDesignerTab DT = new cDesignerTab(); DT.IsMultiline = false; foreach (var TmpPlate in GUIListPlates.GetOutPut()) { cListWells CurrentPlateListWells = TmpPlate.ListWells.Filter(ListClass); cExtendedTable FinalTable = new cExtendedTable(); FinalTable.Name = TmpPlate.GetName() + " - " + CurrentPlateListWells.Count + " wells"; for (int i = 0; i < GUIClasses.GetOutPut()[0].Count; i++) { if (GUIClasses.GetOutPut()[0][i] == 1) { FinalTable.Add(new cExtendedList()); FinalTable[0].Name = cGlobalInfo.ListCellularPhenotypes[i].Name; FinalTable[0].Tag = cGlobalInfo.ListCellularPhenotypes[i]; } } foreach (cWell TmpWell in CurrentPlateListWells) { TmpWell.AssociatedPlate.DBConnection = new cDBConnection(TmpWell.AssociatedPlate, TmpWell.SQLTableName); for (int i = 0; i < GUIClasses.GetOutPut()[0].Count; i++) { if (GUIClasses.GetOutPut()[0][i] == 1) { List<cCellularPhenotype> ListCellularPhenotypesToBeSelected = new List<cCellularPhenotype>(); ListCellularPhenotypesToBeSelected.Add(cGlobalInfo.ListCellularPhenotypes[i]); cExtendedTable TmpET = TmpWell.AssociatedPlate.DBConnection.GetWellValues(TmpWell, LCDT, ListCellularPhenotypesToBeSelected); if (TmpET.Count > 0) FinalTable[0].AddRange(TmpET[0]); break; } } TmpWell.AssociatedPlate.DBConnection.CloseConnection(); } cViewerHistogram VH = new cViewerHistogram(); //cViewerStackedHistogram VSH = new cViewerStackedHistogram(); VH.SetInputData(FinalTable); //VH.Chart.BinNumber = -1; //VSH.Chart.Is //VH.ListProperties.FindByName("Bin Number").SetNewValue((int)100); //VH.ListProperties.FindByName("Bin Number").IsGUIforValue = true; // VSH.Chart.BinNumber = LCDT[0].GetBinNumber(); VH.Chart.IsShadow = false; VH.Chart.IsBorder = true; VH.Chart.IsXGrid = true; VH.Chart.IsHistoNormalized = true; VH.Chart.IsBar = true; VH.Chart.IsYGrid = true; VH.Chart.LabelAxisX = LCDT[0].GetName(); VH.Title = TmpPlate.GetName(); VH.Run(); VH.Chart.Width = 0; VH.Chart.Height = 0; cDesignerSplitter DS = new cDesignerSplitter(); DS.Orientation = Orientation.Vertical; DS.SetInputData(VH.GetOutPut()); cHistogramBuilder HB = new cHistogramBuilder(); HB.SetInputData(FinalTable); HB.BinNumber = -1; HB.IsNormalized = true; HB.Run(); cViewerTable VT = new cViewerTable(); VT.SetInputData(HB.GetOutPut()); VT.Run(); DS.SetInputData(VT.GetOutPut()); DS.Title = TmpPlate.GetName(); DS.Run(); //DS.SetInputData(HB.Get DT.SetInputData(DS.GetOutPut()); } DT.Run(); cDisplayToWindow DTW = new cDisplayToWindow(); DTW.SetInputData(DT.GetOutPut()); DTW.Title = "Single cell based Histograms"; DTW.Run(); DTW.Display(); }
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(); }