private void Draw(PaintArgs p, Plot plot, PlotAxis axis, bool drawMajors) { if (this.Visible && plot != null) { string dockDataViewName = axis.DockDataViewName; PlotDataView plotDataView = plot.DataViews[dockDataViewName]; if (plotDataView != null) { p.Graphics.SetClip(plotDataView.BoundsClip); this.DrawToDataView(p, axis, plotDataView.BoundsClip, drawMajors); foreach (PlotDataView dataView in plot.DataViews) { if (dataView != plotDataView) { if (axis.DockVertical) { if (PlotBase.GetNamesMatch(dataView.GridLinesMirrorVertical, dockDataViewName)) { this.DrawToDataView(p, axis, dataView.BoundsClip, drawMajors); } } else if (PlotBase.GetNamesMatch(dataView.GridLinesMirrorHorizontal, dockDataViewName)) { this.DrawToDataView(p, axis, dataView.BoundsClip, drawMajors); } } } } } }
private Polygon DrawArea(PlotBase canva, Brush color, params Point[] points) { Polygon polygon = new Polygon(); PointCollection pc = new PointCollection(); //List<MapPoint> mps = new List<MapPoint>(); foreach (var p in points) { pc.Add(p); //mps.Add(new MapPoint(p.X, p.Y, pointR)); //MapPoint mp = new MapPoint(p.X,p.Y, pointR); //Plot1.Children.Add(mp.Shape); } polygon.Stroke = color; polygon.StrokeThickness = 2; polygon.Fill = Brushes.Transparent; polygon.MouseDown += Polygon_MouseDown; Plot.SetPoints(polygon, pc); canva.Children.Add(polygon); //DrawMapPoints(canva, points); return(polygon); }
/// <summary> /// 追加画线 /// </summary> /// <param name="chart">K线</param> /// <param name="plot">画线</param> /// <param name="lineColor">颜色</param> /// <param name="type">画线工具类型</param> /// <param name="mp">初始坐标</param> /// <param name="lineWidth">宽度</param> /// <param name="dashPattern">线的类型</param> /// <param name="divID">图层ID</param> /// <returns></returns> public static void AddPlot(Chart chart, PlotBase plot, Color lineColor, Color selectedColor, Point mp, int lineWidth, float[] dashPattern, ChartDiv chartDiv) { CTableEx dataSource = chart.DataSource; if (dataSource.RowsCount >= 2) { double value = chart.GetValueByPoint(chartDiv, mp, AttachYScale.Left); if (plot != null) { plot.Chart = chart; plot.ChartDiv = chartDiv; plot.LineColor = lineColor; plot.SelectedColor = selectedColor; plot.Selected = true; plot.LineWidth = lineWidth; plot.Style = dashPattern; plot.ZOrder = LbCommon.SerialNumber; bool flag = plot.InitPlot(mp); if (flag) { chartDiv.PlotList.Add(plot); chart.SelectedPlot = plot; plot.StartMove(); } } } }
private void DrawPoint(PlotBase canva, MapPoint point, int pointIndex) { //double pointR = 15; canva.Children.Add(point.Shape); point.IndexTb.Text = pointIndex.ToString(); Plot.SetX1(point.IndexTb, point.X); Plot.SetY1(point.IndexTb, point.Y); canva.Children.Add(point.IndexTb); }
private TextBlock DrawText(PlotBase canva, string text, double x, double y) { TextBlock tb = new TextBlock(); tb.Text = text; Plot.SetX1(tb, x); Plot.SetY1(tb, y); canva.Children.Add(tb); return(tb); }
private void HoverTooltipLayer_Loaded(object sender, RoutedEventArgs e) { var visualParent = VisualTreeHelper.GetParent(this); parent = visualParent as PlotBase; while (visualParent != null && parent == null) { visualParent = VisualTreeHelper.GetParent(visualParent); parent = visualParent as PlotBase; } if (parent != null) { parent.MouseMove += Parent_MouseMove; parent.MouseLeave += Parent_MouseLeave; parent.PreviewMouseLeftButtonDown += Parent_PreviewMouseLeftButtonDown; } }
public AlignmentPlotCreator(AlignmentData alignment) { var residuals = alignment.ResidualData; Heatmap = HeatmapFactory.CreateAlignedHeatmap(alignment.HeatScores, alignment.BaselineIsAmtDB); NetResidual = ScatterPlotFactory.CreateResidualPlot(residuals.Net, residuals.LinearCustomNet, residuals.LinearNet, "NET Residuals", "Scans", "NET"); MassHistogram = HistogramFactory.CreateHistogram(alignment.MassErrorHistogram, "Mass Error", "Mass Error (ppm)"); NetHistogram = HistogramFactory.CreateHistogram(alignment.NetErrorHistogram, "NET Error", "NET Error"); MassMzResidual = ScatterPlotFactory.CreateResidualPlot(residuals.Mz, residuals.MzMassError, residuals.MzMassErrorCorrected, "Mass Residuals", "m/z", "Mass Errors"); MassScanResidual = ScatterPlotFactory.CreateResidualPlot(residuals.Net, residuals.MzMassError, residuals.MzMassErrorCorrected, "Mass Residuals", "Scan", "Mass Errors"); }
private void UpdateChannelList(Plot plot) { this.m_ChannelList.Clear(); foreach (PlotChannelBase channel in plot.Channels) { if (this.Axis is PlotXAxis) { if (PlotBase.GetNamesMatch(this.Axis.Name, channel.XAxisName)) { this.m_ChannelList.Add(channel); } } else if (this.Axis is PlotYAxis && PlotBase.GetNamesMatch(this.Axis.Name, channel.YAxisName)) { this.m_ChannelList.Add(channel); } } }
/// <summary> /// 画原始点 /// </summary> /// <param name="canva"></param> /// <param name="points"></param> private void DrawMapPoints(PlotBase canva, params MapPoint[] points) { //double pointR = 15; int i = 1; int count = points.Length; foreach (var p in points) { //MapPoint mp = new MapPoint(p.X, p.Y, pointR); canva.Children.Add(p.Shape); p.IndexTb.Text = (OriginalPoints.Count - count + i).ToString(); i++; Plot.SetX1(p.IndexTb, p.X); Plot.SetY1(p.IndexTb, p.Y); canva.Children.Add(p.IndexTb); } }
public PlotPrintAdapter(PlotBase value) { this.m_PlotBase = value; base.DoCreate(); }
private void LoadClusters(IEnumerable <UMCClusterLightMatched> clusters) { var clustersOnly = clusters.Select(cluster => cluster.Cluster).ToList(); ClustersPlotModel = ScatterPlotFactory.CreateClusterMassScatterPlot(clustersOnly); }
/// <summary> /// 创建控件 /// </summary> public ChartExtend2() { InitControl(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(); this.tsmiAddIndicator = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiAddPlot = new System.Windows.Forms.ToolStripMenuItem(); this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiDay = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiMinute = new System.Windows.Forms.ToolStripMenuItem(); // // contextMenuStrip1 // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.tsmiAddIndicator, this.tsmiAddPlot, this.ToolStripMenuItem }); this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Size = new System.Drawing.Size(153, 92); // // tsmiAddIndicator // this.tsmiAddIndicator.Name = "tsmiAddIndicator"; this.tsmiAddIndicator.Size = new System.Drawing.Size(152, 22); this.tsmiAddIndicator.Text = "添加指标"; // // tsmiAddPlot // this.tsmiAddPlot.Name = "tsmiAddPlot"; this.tsmiAddPlot.Size = new System.Drawing.Size(152, 22); this.tsmiAddPlot.Text = "画线工具"; // // ToolStripMenuItem // this.ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.tsmiMinute, this.tsmiDay }); this.ToolStripMenuItem.Name = "ToolStripMenuItem"; this.ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.ToolStripMenuItem.Text = "切换周期"; // // tsmi60M // this.tsmiDay.Name = "tsmiDay"; this.tsmiDay.Size = new System.Drawing.Size(152, 22); this.tsmiDay.Text = "日线"; this.tsmiDay.Click += new System.EventHandler(this.tsmiDay_Click); // // tsmiMinute // this.tsmiMinute.Name = "tsmiMinute"; this.tsmiMinute.Size = new System.Drawing.Size(152, 22); this.tsmiMinute.Text = "分时图"; this.tsmiMinute.Click += new System.EventHandler(this.tsmiMinute_Click); //加载指标 foreach (string enumName in GetSystemIndicators()) { ToolStripMenuItem indicatorButton = new ToolStripMenuItem(enumName); indicatorButton.Click += new EventHandler(indicatorButton_Click); tsmiAddIndicator.DropDownItems.Add(indicatorButton); } ToolStripMenuItem deleteButton = new ToolStripMenuItem(); deleteButton.Text = "[删除所选]"; deleteButton.Width = 100; deleteButton.Click += new EventHandler(plotButton_Click); deleteButton.Tag = "DELETE"; tsmiAddPlot.DropDownItems.Add(deleteButton); //加载画线工具 foreach (string enumName in GetSystemPlots()) { PlotBase plb = CreatePlot(enumName); if (plb != null) { ToolStripMenuItem plotButton = new ToolStripMenuItem(); plotButton.Text = plb.Desc; plotButton.Width = 100; plotButton.Click += new EventHandler(plotButton_Click); plotButton.Tag = enumName; tsmiAddPlot.DropDownItems.Add(plotButton); } } ContextMenuStrip = contextMenuStrip1; ChangeCycle(); UseNewRectangle = true; }
/// <summary> /// 创建控件 /// </summary> public ChartExtend() { InitControl(); minuteDatas = GetSecurityMinuteDatas(Application.StartupPath + "\\SH600000_M.txt"); thisTimer.Enabled = true; thisTimer.Tick += new EventHandler(thisTimer_Tick); thisTimer.Interval = 100; this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(); this.tsmiAddIndicator = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiAddPlot = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiGuanyu = new System.Windows.Forms.ToolStripMenuItem(); this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tsmi5M = new System.Windows.Forms.ToolStripMenuItem(); this.tsmi15M = new System.Windows.Forms.ToolStripMenuItem(); this.tsmi30M = new System.Windows.Forms.ToolStripMenuItem(); this.tsmi60M = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiMinute = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiBS = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiKLine = new System.Windows.Forms.ToolStripMenuItem(); // // contextMenuStrip1 // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.tsmiAddIndicator, this.tsmiAddPlot, this.ToolStripMenuItem, this.tsmiBS, this.tsmiKLine, this.tsmiGuanyu }); this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Size = new System.Drawing.Size(153, 92); // // tsmiAddIndicator // this.tsmiAddIndicator.Name = "tsmiAddIndicator"; this.tsmiAddIndicator.Size = new System.Drawing.Size(152, 22); this.tsmiAddIndicator.Text = "添加指标"; // // tsmiAddPlot // this.tsmiAddPlot.Name = "tsmiAddPlot"; this.tsmiAddPlot.Size = new System.Drawing.Size(152, 22); this.tsmiAddPlot.Text = "画线工具"; // // ToolStripMenuItem // this.ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.tsmiMinute, this.tsmi5M, this.tsmi15M, this.tsmi30M, this.tsmi60M }); this.ToolStripMenuItem.Name = "ToolStripMenuItem"; this.ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.ToolStripMenuItem.Text = "切换周期"; this.tsmiBS.Name = "ToolStripMenuItem"; this.tsmiBS.Size = new System.Drawing.Size(152, 22); this.tsmiBS.Text = "买卖标记"; this.tsmiBS.Click += new EventHandler(tsmiBS_Click); this.tsmiKLine.Name = "ToolStripMenuItem"; this.tsmiKLine.Size = new System.Drawing.Size(152, 22); this.tsmiKLine.Text = "纯K线界面"; this.tsmiKLine.Click += new EventHandler(tsmiKLine_Click); this.tsmiGuanyu.Name = "ToolStripMenuItem"; this.tsmiGuanyu.Size = new System.Drawing.Size(152, 22); this.tsmiGuanyu.Text = "关于"; this.tsmiGuanyu.Click += new EventHandler(tsmiGuanyu_Click); // // tsmi5M // this.tsmi5M.Name = "tsmi5M"; this.tsmi5M.Size = new System.Drawing.Size(152, 22); this.tsmi5M.Text = "5分钟"; this.tsmi5M.Click += new System.EventHandler(this.tsmi5M_Click); // // tsmi15M // this.tsmi15M.Name = "tsmi15M"; this.tsmi15M.Size = new System.Drawing.Size(152, 22); this.tsmi15M.Text = "15分钟"; this.tsmi15M.Click += new System.EventHandler(this.tsmi15M_Click); // // tsmi30M // this.tsmi30M.Name = "tsmi30M"; this.tsmi30M.Size = new System.Drawing.Size(152, 22); this.tsmi30M.Text = "30分钟"; this.tsmi30M.Click += new System.EventHandler(this.tsmi30M_Click); // // tsmi60M // this.tsmi60M.Name = "tsmi60M"; this.tsmi60M.Size = new System.Drawing.Size(152, 22); this.tsmi60M.Text = "60分钟"; this.tsmi60M.Click += new System.EventHandler(this.tsmi60M_Click); // // tsmiMinute // this.tsmiMinute.Name = "tsmiMinute"; this.tsmiMinute.Size = new System.Drawing.Size(152, 22); this.tsmiMinute.Text = "分时图"; this.tsmiMinute.Click += new System.EventHandler(this.tsmiMinute_Click); //加载指标 foreach (string enumName in GetSystemIndicators()) { ToolStripMenuItem indicatorButton = new ToolStripMenuItem(enumName); indicatorButton.Click += new EventHandler(indicatorButton_Click); tsmiAddIndicator.DropDownItems.Add(indicatorButton); } ToolStripMenuItem deleteButton = new ToolStripMenuItem(); deleteButton.Text = "[删除所选]"; deleteButton.Width = 100; deleteButton.Click += new EventHandler(plotButton_Click); deleteButton.Tag = "DELETE"; tsmiAddPlot.DropDownItems.Add(deleteButton); //加载画线工具 foreach (string enumName in GetSystemPlots()) { PlotBase plb = CreatePlot(enumName); if (plb != null) { ToolStripMenuItem plotButton = new ToolStripMenuItem(); plotButton.Text = plb.Desc; plotButton.Width = 100; plotButton.Click += new EventHandler(plotButton_Click); plotButton.Tag = enumName; tsmiAddPlot.DropDownItems.Add(plotButton); } } ContextMenuStrip = contextMenuStrip1; }
/// <summary> /// Updates the plots with data stored in the cache. /// </summary> private void UpdatePlotsWithClusterData(UMCClusterLightMatched matchedCluster) { //TODO: Make this select mass! ClusterMassPlot = ScatterPlotFactory.CreateFeatureMassScatterPlot(matchedCluster.Cluster.Features); //TODO: Make this select drift time! ClusterDriftPlot = ScatterPlotFactory.CreateFeatureDriftTimeScatterPlot(matchedCluster.Cluster.Features); var cluster = matchedCluster.Cluster; // Then we find all the nearby clusters var massPpm = ClusterTolerances.Mass; var net = ClusterTolerances.Net; //TODO: Add other clusters back // var minMass = FeatureLight.ComputeDaDifferenceFromPPM(cluster.MassMonoisotopic, massPpm); //var maxMass = FeatureLight.ComputeDaDifferenceFromPPM(cluster.MassMonoisotopic, -massPpm); //var minNet = cluster.Net - net; //var maxNet = cluster.Net + net; //var otherClusters // = SingletonDataProviders.Providers.ClusterCache.FindNearby(minMass, maxMass, minNet, maxNet); //// Remove self from the list //var index = otherClusters.FindIndex(x => x.Id == cluster.Id); //if (index > -1) //{ // otherClusters.RemoveAt(index); //} //// Then find the matching clusters and map them back to previously matched (to mass tag data) //var otherClusterMatches = new List<UMCClusterLightMatched>(); //otherClusters.ForEach(x => otherClusterMatches.Add(FeatureCacheManager<UMCClusterLightMatched>.FindById(x.Id))); //foreach (var matchedOtherCluster in otherClusterMatches) //{ // matchedOtherCluster.Cluster.Features.Clear(); // matchedOtherCluster.Cluster.ReconstructUMCCluster(SingletonDataProviders.Providers, false, false); //} // Map out the MS/MS spectra. var msmsFeatures = new List <MSFeatureMsMs>(); foreach (var feature in cluster.Features) { foreach (var msFeature in feature.MsFeatures) { msmsFeatures.AddRange(msFeature.MSnSpectra.Select(spectrum => new MSFeatureMsMs { FeatureID = msFeature.Id, FeatureGroupID = msFeature.GroupId, Mz = msFeature.Mz, PrecursorMZ = spectrum.PrecursorMz, FeatureScan = msFeature.Scan, MsMsScan = spectrum.Scan, MassMonoisotopicAligned = msFeature.MassMonoisotopicAligned, ChargeState = msFeature.ChargeState, Sequence = "", PeptideSequence = "" })); } } var features = new List <UMCLight>(); features.AddRange(matchedCluster.Cluster.Features); Features.Clear(); features.ForEach(x => Features.Add(new UMCTreeViewModel(x))); SelectedFeature = Features[0]; }
/// <summary> /// Initializes a new instance of <see cref="PlotCompositionChange"/> /// </summary> /// <param name="master">Master <see cref="PlotBase"/> of composition that change</param> public PlotCompositionChange(PlotBase master) { this.master = master; }