public void PValueLogHistogram(CartesianChart chart) { int twentyPercent = 0; int fortyPercent = 0; int sixtyPercent = 0; int eightyPercent = 0; int oneHundrerdPercent = 0; double popSize = (db.SubData[0].Genotype.Length) * (db.SubData[0].TraitValue.Length) * 1.0; if (PValhistChart == null) { PValhistChart = new HistogramChart(chart); } PValhistChart.RemvoeColumnSeries(); PValhistChart.AxisXTitle = "-Log(P-Value)"; PValhistChart.AxisYTitle = "-Log(Proportion of Markers %)"; foreach (double d in pLogValues) { if (d >= 0.0 && d < 0.2) { twentyPercent++; } else if (d >= 0.2 && d < 0.4) { fortyPercent++; } else if (d >= 0.4 && d < 0.6) { sixtyPercent++; } else if (d >= 0.6 && d < 0.8) { eightyPercent++; } else if (d >= 0.8 && d <= 1.0) { oneHundrerdPercent++; } } List <double> pValues = new List <double>(); pValues.Add((twentyPercent / popSize)); pValues.Add((fortyPercent / popSize)); pValues.Add((sixtyPercent / popSize)); pValues.Add((eightyPercent / popSize)); pValues.Add((oneHundrerdPercent / popSize)); List <string> pTitles = new List <string>(); pTitles.Add("0-20%"); pTitles.Add("20-40%"); pTitles.Add("40-60%"); pTitles.Add("60-80%"); pTitles.Add("80-100%"); PValhistChart.AddColumnSeries(pTitles, pValues, ColorConstants.highliteColor); }
/// <summary> /// 创建产品实例 /// </summary> /// <param name="type"></param> /// <returns></returns> public static IChart GetChart(string type) { IChart chart = null; switch (type) { case "histogram": chart = new HistogramChart(); Console.WriteLine("初始化设置柱状图"); break; case "pie": chart = new PieChart(); Console.WriteLine("初始化设置饼状图"); break; case "line": chart = new LineChart(); Console.WriteLine("初始化设置折线图"); break; default: Console.WriteLine("当前类型不存在"); break; } return(chart); }
private void ValuesRadioBtn_Checked(object sender, RoutedEventArgs e) { RadioButton radioButton = sender as RadioButton; int[] histogram; switch (radioButton.Name) { case "AveragedValuesRadioBtn": histogram = averagedHistogram; break; case "RedValuesRadioBtn": histogram = redHistogram; break; case "GreenValuesRadioBtn": histogram = greenHistogram; break; case "BlueValuesRadioBtn": histogram = blueHistogram; break; default: throw new ArgumentOutOfRangeException(); } HistogramChart.DisplayHistogram(histogram); }
/// <summary> /// Gets the SVG histogram. /// </summary> /// <param name="model">The histogram model</param> /// <param name="is3D">if set to <c>true</c> it will be 3D</param> /// <param name="depth">The depth.</param> /// <returns></returns> public static String GetSVGHistogram(this histogramModel model, Boolean is3D = false, short depth = 10) { if (!is3D) { HistogramChart output = new HistogramChart(500, 360, model.targetBins); XmlDocument xml = output.GenerateChart(model.GetDataTableForFrequencies(), histogramModel.DEFAULT_COLUMN_NAME, histogramModel.DEFAULT_COLUMN_VALUE); return(xml.OuterXml); } else { Histogram3DChart output = new Histogram3DChart(500, 360, model.targetBins, depth); XmlDocument xml = output.GenerateChart(model.GetDataTableForFrequencies(), histogramModel.DEFAULT_COLUMN_NAME, histogramModel.DEFAULT_COLUMN_VALUE); return(xml.OuterXml); } }
public static IChart GetChart(string name) { IChart chart = null; if (string.Equals(name, "0", StringComparison.CurrentCultureIgnoreCase)) { chart = new HistogramChart(); } else if (string.Equals(name, "1", StringComparison.CurrentCultureIgnoreCase)) { chart = new PieChart(); } else if (string.Equals(name, "2", StringComparison.CurrentCultureIgnoreCase)) { chart = new LineChart(); } return(chart); }
public static Chart GetChart(String type) { Chart chart = null; if (type.Equals("histogram")) { chart = new HistogramChart(); Console.WriteLine("初始化设置柱状图"); } else if (type.Equals("pie")) { chart = new PieChart(); Console.WriteLine("初始化设置饼状图"); } else if (type.Equals("line")) { chart = new LineChart(); Console.WriteLine("初始化设置折线图"); } return(chart); }
public static IChartable GetChart(string type) { IChartable chart = null; if (type.Equals("histogram", StringComparison.OrdinalIgnoreCase)) { chart = new HistogramChart(); Console.WriteLine("初始化设置柱状图..."); } else if (type.Equals("pie", StringComparison.OrdinalIgnoreCase)) { chart = new PieChart(); Console.WriteLine("初始化设置饼状图..."); } else if (type.Equals("line", StringComparison.OrdinalIgnoreCase)) { chart = new PieChart(); Console.WriteLine("初始化设置折线图..."); } return(chart); }
// Acción que determina que clase utilitzar para crear los "Charts" public void CrearChart(Button button, Label label = null) { ClearLastElements(); BaseChart.Chart.Series.RemoveAllSeries(); //Themes.RefreshTheme(); Themes.BasicAxes(BaseChart.Chart.Axes.Left, BaseChart.Chart.Axes.Right); Themes.AplicarTheme(BaseChart); switch (button.Text) { case "Line": lineChart = new LineChart(BaseChart); break; case "Column Bar": columnBarChart = new ColumnBarChart(BaseChart); break; case "Area": areaChart = new AreaChart(BaseChart); break; case "Pie": pieChart = new PieChart(BaseChart); break; case "Fast Line": fastLineChart = new FastLineChart(BaseChart); break; case "Horizontal Area": horizAreaChart = new HorizontalAreaChart(BaseChart); break; case "Horizontal Bar": horizBarChart = new HorizontalBarChart(BaseChart); break; case "Horizontal Line": horizLineChart = new HorizontalLineChart(BaseChart); break; case "Donut": donutChart = new DonutChart(BaseChart); break; case "Bubble": bubbleChart = new BubbleChart(BaseChart); break; case "Shape": shapeChart = new ShapeChart(BaseChart); break; case "Gantt": gantChart = new GanttChart(BaseChart); break; case "Point/Scatter": point_scatterChart = new Point_ScatterChart(BaseChart); break; case "Interpolating Line": interpolatingChart = new InterpolatingChartFeatures(BaseChart); break; case "Bar Styles": coneBarChart = new BarStylesChartFeatures(BaseChart); break; case "Zoom & Panning": zoomPaningArrowChart = new ZoomPanningChartFeatures(BaseChart); break; case "Bar Gradient": gradientBarChart = new GradientBarChartFeatures(BaseChart); break; case "Bubble Transparent": bubbleTranspChart = new BubbleTransparencyChartFeatures(BaseChart); break; case "Real Time": fLineRealTimeChart = new FLineRealTimeChartFeatures(BaseChart); break; case "Stack Area": stackAreaChart = new StackAreaChartFeatures(BaseChart); break; case "Multiple Pies": multiPiesChart = new MultiplePiesChartFeatures(BaseChart); break; case "Semi-Pie": semiPieChart = new Semi_PieChartFeatures(BaseChart); break; case "Semi-Donut": semiDonutChart = new Semi_DonutChartFeatures(BaseChart); break; case "Arrow": arrowChart = new ArrowChart(BaseChart); break; case "Polar": polarChart = new PolarChart(BaseChart); break; case "Radar": radarChart = new RadarChart(BaseChart); break; case "Pyramid": pyramidChart = new PyramidChart(BaseChart); break; case "Candle": candleChart = new CandleChart(BaseChart); break; case "Histogram": histogramChart = new HistogramChart(BaseChart); break; case "Error": errorChart = new ErrorChart(BaseChart); break; case "ErrorBar": errorBarChart = new ErrorBarChart(BaseChart); break; case "Funnel": funnelChart = new FunnelChart(BaseChart); break; case "Smith": smithChart = new SmithChart(BaseChart); break; case "Bezier": bezierChart = new BezierChart(BaseChart); break; case "HighLow": highLowChart = new HighLowChart(BaseChart); break; case "Speed Time": realTimeChart = new SpeedTimeChart(BaseChart); break; case "Waterfall": waterfallChart = new WaterfallChart(BaseChart); break; case "Volume": volumeChart = new VolumeChart(BaseChart); break; case "Color Grid": colorGridChart = new ColorGridChart(BaseChart); break; case "Polar Bar": polarBarChart = new PolarBarChart(BaseChart); break; case "Inverted Pyramid": invertedPyramidChart = new InvertedPyramidChart(BaseChart); break; case "Horizontal Histogram": horizHistogramChart = new HorizHistogramChart(BaseChart); break; case "Circular Gauge": basicCircGaugeChart = new BasicCircularGaugeChart(BaseChart); break; case "Car Fuel": carFuelChart = new CarFuelChart(BaseChart); break; case "Custom Hand": custPointerGaugeChart = new CustomPointerChart(BaseChart); break; case "Acceleration": accelerationCircularGaugeChart = new AccelerationCircularGaugeChart(BaseChart); break; case "Knob Gauge": basicKnobGaugeChart = new BasicKnobGaugeChart(BaseChart); break; case "Temperature Knob": temperatureKnobChart = new TemperatureKnobChart(BaseChart); break; case "Compass": try { compassChart = new CompassChart(BaseChart); } catch (Exception e) { } break; case "Map GIS": mapGSIChart = new MapGISChart(BaseChart); break; case "World Map": worldMapChart = new WorldMapChart(BaseChart); break; case "TreeMap": treeMapChart = new TreeMapChart(BaseChart); break; case "Basic Clock": basicClockChart = new BasicClockChart(BaseChart); break; case "Custom Clock": customClockChart = new CustomClockChart(BaseChart); break; case "Organizational Chart": basicOrganizationalChart = new BasicOrganizationalChart(BaseChart); break; case "Numeric Gauge": numericGaugeChart = new NumericGaugeChart(BaseChart); break; case "Linear Gauge": linearGaugeChart = new LinearGaugeChart(BaseChart); break; case "Scales": scalesLinearChart = new ScalesLinearChart(BaseChart); break; case "SubLines": moreLinesLinearChart = new MoreLinesLinearChart(BaseChart); break; case "Mobile Battery": batteryLinearChart = new BatteryLinearChart(BaseChart); break; case "Basic Calendar": basicCalendarChart = new BasicCalendarChart(BaseChart, label); break; case "Special Dates": specialDatesChart = new SpecialDatesChart(BaseChart, label); break; case "TagCloud": tagCloudChart = new TagCloudChart(BaseChart); break; case "Add": addStdFunctionsChart = new AddStdFunctionsChart(BaseChart); break; case "Subtract": subtStdFunctionsChart = new SubtStdFunctionsChart(BaseChart); break; case "Multiply": multStdFunctionsChart = new MultStdFunctionsChart(BaseChart); break; case "Divide": divStdFunctionsChart = new DivStdFunctionsChart(BaseChart); break; case "Count": countStdFunctionsChart = new CountStdFunctionsChart(BaseChart); break; case "Average": avgStdFunctionsChart = new AvgStdFunctionsChart(BaseChart); break; case "High": highStdFunctionsChart = new HighStdFunctionsChart(BaseChart); break; case "Low": lowStdFunctionsChart = new LowStdFunctionsChart(BaseChart); break; case "Median Function": medianStdFunctionsChart = new MedianStdFunctionsChart(BaseChart); break; case "Percent Change": percentStdFunctionsChart = new PercentStdFunctionsChart(BaseChart); break; case "ADX": adxProFunctionChart = new ADXProFunctionChart(BaseChart); break; case "AC": acProFunctionChart = new ACProFunctionChart(BaseChart); break; case "Alligator": alligatorProFunctionChart = new AlligatorProFunctionChart(BaseChart); break; case "AO": aoProFunctionChart = new AOProFunctionChart(BaseChart); break; case "ATR": atrProFunctionChart = new ATRProFunctionChart(BaseChart); break; case "Bollinger Bands": bollingerProFunctionChart = new BollingerProFunctionChart(BaseChart); break; case "CCI": cciProFunctionChart = new CCIProFunctionChart(BaseChart); break; case "CLV": clvProFunctionChart = new CLVProFunctionChart(BaseChart); break; case "Compression OHLC": compressionOHLCProFunctionChart = new CompressionOHLCProFunctionChart(BaseChart); break; case "Exp. Average": expAverageProFunctionChart = new ExpAverageProFunctionChart(BaseChart); break; case "Exp. Moving Average": expMovAverageProFunctionChart = new ExpMovAverageProFunctionChart(BaseChart); break; case "Gator Oscillator": gatorOscillProFunctionChart = new GatorOscillProFunctionChart(BaseChart); break; case "Kurtosis": kurtosisProFunctionChart = new KurtosisProFunctionChart(BaseChart); break; case "MACD": macdProFunctionChart = new MACDProFunctionChart(BaseChart); break; case "Momentum": momentumProFunctionChart = new MomentumProFunctionChart(BaseChart); break; case "Momentum Div.": momentumDivProFunctionChart = new MomentumDivProFunctionChart(BaseChart); break; case "Money Flow": moneyFlowProFunctionChart = new MoneyFlowProFunctionChart(BaseChart); break; case "OBV": obvProFunctionChart = new OBVProFunctionChart(BaseChart); break; case "PVO": pvoProFunctionChart = new PVOProFunctionChart(BaseChart); break; case "RSI": rsiProFunctionChart = new RSIProFunctionChart(BaseChart); break; case "RVI": rviProFunctionChart = new RVIProFunctionChart(BaseChart); break; case "Slope": slopeProFunctionChart = new SlopeProFunctionChart(BaseChart); break; case "Smoothed Mov Avg": smoothMovAvgProFunctionChart = new SmoothMovAvgProFunctionChart(BaseChart); break; case "S.A.R.": sarProFunctionChart = new SARProFunctionChart(BaseChart); break; case "Cross Point": crossPointsProFunctionsChart = new CrossPointsProFunctionsChart(BaseChart); break; case "Correlation": correlationProFunctionChart = new CorrelationProFunctionChart(BaseChart); break; case "Cumulative": cumulativeProFunctionChart = new CumulativeProFunctionChart(BaseChart); break; case "Custom Function": calculateEventProFunctionChart = new CalculateEventProFunctionChart(BaseChart); break; case "Exponential Trend": exponentialTrendProFunctionChart = new ExponentialTrendProFunctionChart(BaseChart); break; case "Fitting Linearizable": fittingProFunctionChart = new FittingProFunctionChart(BaseChart); break; case "Performance": performanceProFunctionChart = new PerformanceProFunctionChart(BaseChart); break; case "Perimeter": perimeterProFunctionChart = new PerimeterProFunctionChart(BaseChart); break; case "Finding Coefficients": findCoeffProFunctionChart = new FindCoeffProFunctionChart(BaseChart); break; case "Down Sampling": downSamplingProFunctionChart = new DownSamplingProFunctionChart(BaseChart); break; case "RMS": rmsProFunctionChart = new RMSProFunctionChart(BaseChart); break; case "Smoothing Function": smoothingProFunctionChart = new SmoothingProFunctionChart(BaseChart); break; case "Standard Deviation": stdDeviationProFunctionChart = new StdDeviationProFunctionChart(BaseChart); break; case "Trendline": trendlineProFunctionChart = new TrendlineProFunctionChart(BaseChart); break; case "Variance": varianceProFunctionChart = new VarianceProFunctionChart(BaseChart); break; case "SPC": spcProFunctionChart = new SPCProFunctionChart(BaseChart); break; case "Cumulative Histogram": cumulativeHistogProFunctionChart = new CumulativeHistogProFunctionChart(BaseChart); break; case "Skewness": skewnessProFunctionChart = new SkewnessProFunctionChart(BaseChart); break; } Themes.AplicarOptions(BaseChart); }
public void ChiSquaredHistogramChart(CartesianChart chart) { if (histChartChi == null) { histChartChi = new HistogramChart(chart); } histChartChi.AxisXTitle = "Chi^2 statistic"; histChartChi.AxisYTitle = "Proportion of markers"; double chiVal = 0; double chiExpected = 0; double counterN0 = 0, counterN1 = 0; int twentyPercent = 0; int fortyPercent = 0; int sixtyPercent = 0; int eightyPercent = 0; int oneHundrerdPercent = 0; double popSize = this.db.SubData[0].Genotype.Length * 1.0; // this is our 100% //we iterate over all the population for (int i = 0; i < this.db.SubData[0].Genotype.Length; i++) { counterN0 = 0; counterN1 = 0; chiVal = 0; chiExpected = 0; //we iterate over the genotype of each person for (int j = 0; j < this.db.SubData.Count; j++) { if (this.db.SubData[j].Genotype[0, i] == 0) { counterN0++; } else if (this.db.SubData[j].Genotype[0, i] == 1) { counterN1++; } } //we finished going over the persons genotype divide by the 100 percent and add to the relevant bucket chiExpected = (counterN0 + counterN1) / 2; chiVal = (Math.Pow((counterN0 - chiExpected), 2.0) + Math.Pow((counterN1 - chiExpected), 2.0)) / chiExpected; if (chiVal >= 0.0 && chiVal < 0.2) { twentyPercent++; } else if (chiVal >= 0.2 && chiVal < 0.4) { fortyPercent++; } else if (chiVal >= 0.4 && chiVal < 0.6) { sixtyPercent++; } else if (chiVal >= 0.6 && chiVal < 0.8) { eightyPercent++; } else if (chiVal >= 0.8 && chiVal <= 1.0) { oneHundrerdPercent++; } } List <double> pValues = new List <double>(); pValues.Add((twentyPercent / popSize)); pValues.Add((fortyPercent / popSize)); pValues.Add((sixtyPercent / popSize)); pValues.Add((eightyPercent / popSize)); pValues.Add((oneHundrerdPercent / popSize)); List <string> pTitles = new List <string>(); pTitles.Add("0-20%"); pTitles.Add("20-40%"); pTitles.Add("40-60%"); pTitles.Add("60-80%"); pTitles.Add("80-100%"); histChartChi.AddColumnSeries(pTitles, pValues, ColorConstants.highliteColor); }
public void TraitDistributionHistogram(int traitIndex, CartesianChart chart) { if (traitHistogramDist == null) { traitHistogramDist = new HistogramChart(chart); } traitHistogramDist.AxisXTitle = "Trait Values"; traitHistogramDist.AxisYTitle = "Proportion of Individuals"; traitHistogramDist.RemvoeColumnSeries(); double max, min; max = db.SubData[0].TraitValue[0, traitIndex]; min = db.SubData[0].TraitValue[0, traitIndex]; double popSize = 0.0; // make sure that our population is according to the size of the traits that we actually have info about them foreach (DataIndividualsAndTraits ind in db.SubData) { if (ind.TraitValueOk[0, traitIndex] == true) { popSize++; } } for (int i = 0; i < db.SubData.Count; i++) { if (db.SubData[i].TraitValue[0, traitIndex] > max && db.SubData[i].TraitValueOk[0, traitIndex] == true) { max = db.SubData[i].TraitValue[0, traitIndex]; } } double twentyPrecent = 0.0, fortyPrecent = 0.0, sixtyPrecent = 0.0, eightPrecent = 0.0, onehundredPrecent = 0.0; for (int i = 0; i < this.db.SubData.Count; i++) { double temp = db.SubData[i].TraitValue[0, traitIndex]; temp = temp / max; if (temp >= 0.0 && temp < 0.2 && db.SubData[i].TraitValueOk[0, traitIndex] == true) { twentyPrecent++; } else if (temp >= 0.2 && temp < 0.4 && db.SubData[i].TraitValueOk[0, traitIndex] == true) { fortyPrecent++; } else if (temp >= 0.4 && temp < 0.6 && db.SubData[i].TraitValueOk[0, traitIndex] == true) { sixtyPrecent++; } else if (temp >= 0.6 && temp < 0.8 && db.SubData[i].TraitValueOk[0, traitIndex] == true) { eightPrecent++; } else if (temp >= 0.8 && temp < 1.0 && db.SubData[i].TraitValueOk[0, traitIndex] == true) { onehundredPrecent++; } } //get the proportion of the indivivuals List <string> titles = new List <string>(); titles.Add("0.0-" + (max * 0.2).ToString("0.00")); titles.Add((max * 0.2).ToString("0.00") + "-" + (max * 0.4).ToString("0.00")); titles.Add((max * 0.4).ToString("0.00") + "-" + (max * 0.6).ToString("0.00")); titles.Add((max * 0.6).ToString("0.00") + "-" + (max * 0.8).ToString("0.00")); titles.Add((max * 0.8).ToString("0.00") + "-" + (max).ToString("0.00")); List <double> values = new List <double>(); values.Add(twentyPrecent / popSize); values.Add(fortyPrecent / popSize); values.Add(sixtyPrecent / popSize); values.Add(eightPrecent / popSize); values.Add(onehundredPrecent / popSize); traitHistogramDist.AddColumnSeries(titles, values, ColorConstants.highliteColor); }
public void PValueHistogram(CartesianChart chart) { if (PValhistChart == null) { PValhistChart = new HistogramChart(chart); } PValhistChart.AxisXTitle = "P-Value"; PValhistChart.AxisYTitle = "Proportion of Markers %"; PValhistChart.RemvoeColumnSeries(); int twentyPercent = 0; int fortyPercent = 0; int sixtyPercent = 0; int eightyPercent = 0; int oneHundrerdPercent = 0; double temp = 0.0; double popSize = (db.SubData[0].Genotype.Length) * (db.SubData[0].TraitValue.Length) * 1.0; //go over all the individuals of first marker and first trait and calculate p value //get the answer and put it in the correct bin for (int i = 0; i < this.db.SubData[0].Genotype.Length; i++) { //we get the wanted genotype index for (int j = 0; j < this.db.SubData[0].TraitValue.Length; j++) { //we get the wanted trait index List <double> no = new List <double>(); List <double> n1 = new List <double>(); for (int k = 0; k < this.db.SubData.Count; k++) { if (this.db.SubData[k].Genotype[0, i] == 0) { no.Add(this.db.SubData[k].TraitValue[0, j]); } else if (this.db.SubData[k].Genotype[0, i] == 1) { n1.Add(this.db.SubData[k].TraitValue[0, j]); } //iterate over all the people and gather two groups of n0 and n1 } //calculate the pvalue for trait and genotype and put in the correct bin //temp=result of p value temp = StatisticCalculations.PValueTStatistic(no, n1); pLogValues.Add((-1.0 * Math.Log(temp))); if (temp >= 0.0 && temp < 0.2) { twentyPercent++; } else if (temp >= 0.2 && temp < 0.4) { fortyPercent++; } else if (temp >= 0.4 && temp < 0.6) { sixtyPercent++; } else if (temp >= 0.6 && temp < 0.8) { eightyPercent++; } else if (temp >= 0.8 && temp <= 1.0) { oneHundrerdPercent++; } } } List <double> pValues = new List <double>(); pValues.Add(twentyPercent / popSize); pValues.Add(fortyPercent / popSize); pValues.Add(sixtyPercent / popSize); pValues.Add(eightyPercent / popSize); pValues.Add(oneHundrerdPercent / popSize); List <string> pTitles = new List <string>(); pTitles.Add("0-20%"); pTitles.Add("20-40%"); pTitles.Add("40-60%"); pTitles.Add("60-80%"); pTitles.Add("80-100%"); PValhistChart.AddColumnSeries(pTitles, pValues, ColorConstants.highliteColor); }
public void SegregationMarkerHistogram(CartesianChart chart) { HistogramChart histChart = new HistogramChart(chart); histChart.AxisXTitle = " n0/(n1+n0)"; histChart.AxisYTitle = "Proportion of Markers %"; int twentyPercent = 0, fortyPercent = 0, sixtyPercent = 0, eightyPercent = 0, oneHundrerdPercent = 0; double temp, counterN0 = 0, counterN1 = 0; double genotypeSize = db.SubData[0].Genotype.Length; //we iterate over all the population for (int i = 0; i < this.db.SubData[0].Genotype.Length; i++) { counterN0 = 0; counterN1 = 0; //we iterate over the genotype of each person for (int j = 0; j < this.db.SubData.Count; j++) { if (this.db.SubData[j].Genotype[0, i] == 0) { counterN0++; } else if (this.db.SubData[j].Genotype[0, i] == 1) { counterN1++; } } //we finished going over the persons genotype divide by the 100 percent and add to the relevant bucket temp = counterN0 / (counterN1 + counterN0); if (temp >= 0.0 && temp < 0.2) { twentyPercent++; } else if (temp >= 0.2 && temp < 0.4) { fortyPercent++; } else if (temp >= 0.4 && temp < 0.6) { sixtyPercent++; } else if (temp >= 0.6 && temp < 0.8) { eightyPercent++; } else if (temp >= 0.8 && temp <= 1.0) { oneHundrerdPercent++; } } List <string> titles = new List <string>(); titles.Add("0-20%"); titles.Add("20-40%"); titles.Add("40-60%"); titles.Add("60-80%"); titles.Add("80-100%"); List <double> values = new List <double>(); values.Add(twentyPercent / genotypeSize); values.Add(fortyPercent / genotypeSize); values.Add(sixtyPercent / genotypeSize); values.Add(eightyPercent / genotypeSize); values.Add(oneHundrerdPercent / genotypeSize); histChart.AddColumnSeries(titles, values, ColorConstants.highliteColor); }
public void MarkerQualityHistogram(CartesianChart chart) { HistogramChart histChart = new HistogramChart(chart); histChart.AxisXTitle = " Missing Data %"; histChart.AxisYTitle = "Proportion of Markers %"; // find out which markers are: //0-20% //20-40% //40-60% //60-80% //80-100% int twentyPercent = 0; int fortyPercent = 0; int sixtyPercent = 0; int eightyPercent = 0; int oneHundrerdPercent = 0; double popSize = db.SubData.Count * 1.0; double temp; double counter = 0; // this is our 100% double genotypeSize = db.SubData[0].Genotype.Length; //we iterate over all the population for (int i = 0; i < this.db.SubData.Count; i++) { counter = 0; //we iterate over the genotype of each person for (int j = 0; j < this.db.SubData[i].Genotype.Length; j++) { if (this.db.SubData[i].GenotypeOk[0, j] == true) { counter++; } } //we finished going over the persons genotype divide by the 100 percent and add to the relevant bucket temp = counter / genotypeSize; if (temp >= 0.0 && temp < 0.2) { twentyPercent++; } else if (temp >= 0.2 && temp < 0.4) { fortyPercent++; } else if (temp >= 0.4 && temp < 0.6) { sixtyPercent++; } else if (temp >= 0.6 && temp < 0.8) { eightyPercent++; } else if (temp >= 0.8 && temp <= 1.0) { oneHundrerdPercent++; } } //we have all the data now we arrange it in the format the histogram has to accept List <string> titles = new List <string>(); titles.Add("0-20%"); titles.Add("20-40%"); titles.Add("40-60%"); titles.Add("60-80%"); titles.Add("80-100%"); List <double> values = new List <double>(); values.Add(twentyPercent / popSize); values.Add(fortyPercent / popSize); values.Add(sixtyPercent / popSize); values.Add(eightyPercent / popSize); values.Add(oneHundrerdPercent / popSize); histChart.AddColumnSeries(titles, values, ColorConstants.highliteColor); }
private void Button1_Click(object sender, EventArgs e) { DialogResult dialogResult = openFileDialog1.ShowDialog(); if (dialogResult.Equals(DialogResult.OK)) { StreamReader fileIN; // fileName = openFileDialog1.FileName; fileIN = new StreamReader(fileName); string tableTitle = fileIN.ReadLine(); string[] values; while (fileIN.Peek() != -1) { values = fileIN.ReadLine().Split(','); vehicleType.Add(values[0]); vehicleYear2018Sales.Add(Int32.Parse(values[1])); vehicleYear2019Sales.Add(Int32.Parse(values[2])); } fileIN.Close(); } // Plotting the Data in a graph //salesBarGraph.Titles.Add(tableName); //salesBarGraph.Series.Add("2019"); //salesBarGraph.Series[0].Points.DataBindY(vehicleYear2018Sales); //salesBarGraph.Series[0].LegendText = "2018"; //salesBarGraph.Series[1].Points.DataBindY(vehicleYear2019Sales); //for (int i = 0; i < vehicleType.Count; i++) // salesBarGraph.Series[0].Points[i].AxisLabel = vehicleType[i]; //salesBarGraph.SaveImage("VehicleSales.emf", ChartImageFormat.Emf); //mktShareChart.Titles.Add("Market Share of Vehicles 2019"); //mktShareChart.Series[0].Points.DataBindY(vehicleYear2019Sales); //mktShareChart.Series[0].LegendText = "2019"; //for (int i=0; i<vehicleType.Count; i++) //mktShareChart.Series[0].Points[i].AxisLabel = vehicleType[i]; //mktShareChart.SaveImage("Market Share of 2019.emf", ChartImageFormat.Emf); //Convert Charts To SVG DataTable table1 = new DataTable("Vehicle Sales 2018 & 2019"), table2 = new DataTable("2019 Market Share"); //table1 = ConvertToDataTable(vehicleYear2018Sales); //table2 = ConvertToDataTable(vehicleYear2019Sales); table1.Columns.Add("Type", typeof(string)); table1.Columns.Add("Quantity", typeof(double)); table2.Columns.Add("Type", typeof(string)); table2.Columns.Add("Quantity", typeof(double)); for (int i = 0; i < vehicleYear2018Sales.Count; i++) { table1.Rows.Add("2018 " + vehicleType[i], vehicleYear2018Sales[i].ToString()); table1.Rows.Add("2019 " + vehicleType[i], vehicleYear2019Sales[i].ToString()); table2.Rows.Add(vehicleType[i], vehicleYear2019Sales[i].ToString()); } SVGObject svg = new SVGObject(); HistogramChart his = new HistogramChart(300, 300, table1.Rows.Count); //his. // Credits to Gerard Viader XmlDocument xml = his.GenerateChart(table1, table1.Columns["Type"].ToString(), table1.Columns["Quantity"].ToString()); xml.Save("2018 & 2019 Vehicle Sales.svg"); PieChart pie = new PieChart(500, 500, table2.Rows.Count); xml = pie.GenerateChart(table2, table2.Columns["Type"].ToString(), table2.Columns["Quantity"].ToString()); xml.Save("2019 Market Share.svg"); //xml = his.GenerateChart(table1, table1.Columns["Type"].ToString(), table1.Columns["2019"].ToString()); //xml.Save("2019 Market Share.svg"); Application.Exit(); }