本文整理汇总了C#中ZedGraph.TextObj类的典型用法代码示例。如果您正苦于以下问题:C# TextObj类的具体用法?C# TextObj怎么用?C# TextObj使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextObj类属于ZedGraph命名空间,在下文中一共展示了TextObj类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateChart
public void CreateChart(ZedGraphControl zgc)
{
GraphPane myPane = zgc.GraphPane;
// Set the titles and axis labels
myPane.Title.Text = "Elevation above ground";
myPane.XAxis.Title.Text = "Distance (m)";
myPane.YAxis.Title.Text = "Elevation (m)";
LineItem myCurve;
myCurve = myPane.AddCurve("Planner", list1, Color.Red, SymbolType.None);
myCurve = myPane.AddCurve("GE", list2, Color.Green, SymbolType.None);
foreach (PointPair pp in list1)
{
// Add a another text item to to point out a graph feature
TextObj text = new TextObj((string)pp.Tag, pp.X, pp.Y);
// rotate the text 90 degrees
text.FontSpec.Angle = 90;
text.FontSpec.FontColor = Color.White;
// Align the text such that the Right-Center is at (700, 50) in user scale coordinates
text.Location.AlignH = AlignH.Right;
text.Location.AlignV = AlignV.Center;
// Disable the border and background fill options for the text
text.FontSpec.Fill.IsVisible = false;
text.FontSpec.Border.IsVisible = false;
myPane.GraphObjList.Add(text);
}
// Show the x axis grid
myPane.XAxis.MajorGrid.IsVisible = true;
myPane.XAxis.Scale.Min = 0;
myPane.XAxis.Scale.Max = distance;
// Make the Y axis scale red
myPane.YAxis.Scale.FontSpec.FontColor = Color.Red;
myPane.YAxis.Title.FontSpec.FontColor = Color.Red;
// turn off the opposite tics so the Y tics don't show up on the Y2 axis
myPane.YAxis.MajorTic.IsOpposite = false;
myPane.YAxis.MinorTic.IsOpposite = false;
// Don't display the Y zero line
myPane.YAxis.MajorGrid.IsZeroLine = true;
// Align the Y axis labels so they are flush to the axis
myPane.YAxis.Scale.Align = AlignP.Inside;
// Manually set the axis range
//myPane.YAxis.Scale.Min = -1;
//myPane.YAxis.Scale.Max = 1;
// Fill the axis background with a gradient
//myPane.Chart.Fill = new Fill(Color.White, Color.LightGray, 45.0f);
// Calculate the Axis Scale Ranges
try
{
zg1.AxisChange();
}
catch { }
}
示例2: RenderBarLabel
/// <summary>
/// Render text at the bottom of a bar
/// </summary>
/// <param name="gp"></param>
/// <param name="d"></param>
/// <param name="x"></param>
protected override void RenderBarLabel(GraphPane gp, RequestDataResults d, float x)
{
var requestText = new TextObj(d.Request + " -", x, 0).Style(Color.Black, 7);
requestText.FontSpec.Angle = 25;
requestText.Location.AlignH = AlignH.Right;
gp.GraphObjList.Add(requestText);
}
示例3: RenderBarLabel
protected override void RenderBarLabel(GraphPane gp, RequestDataResults d, float x)
{
var dateText = new TextObj(d.Date.ToShortDateString() + " .", x, 0);
dateText.FontSpec.Fill.IsVisible = false;
dateText.FontSpec.Border.IsVisible = false;
dateText.FontSpec.FontColor = Color.Black;
dateText.FontSpec.Size = 7;
dateText.FontSpec.Angle = 45;
dateText.Location.AlignH = AlignH.Right;
gp.GraphObjList.Add(dateText);
}
示例4: RenderLegend
protected override void RenderLegend(GraphPane gp, IEnumerable<RequestDataResults> dataResults)
{
var hostName = new TextObj(dataResults.First().HostName, dataResults.Count() + 1, dataResults.Max(x => x.AverageResponseTime) * 1.1);
hostName.FontSpec.Fill.IsVisible = false;
hostName.FontSpec.Border.IsVisible = false;
hostName.FontSpec.FontColor = Color.Black;
hostName.FontSpec.Size = 7;
gp.GraphObjList.Add(hostName);
var date = new TextObj(DateTime.Now.ToString(), dataResults.Count() + 1, dataResults.Max(x => x.AverageResponseTime) * 1.05);
date.FontSpec.Fill.IsVisible = false;
date.FontSpec.Border.IsVisible = false;
date.FontSpec.FontColor = Color.Black;
date.FontSpec.Size = 7;
gp.GraphObjList.Add(date);
}
示例5: AddLabel
public static void AddLabel(this GraphPane pane, double x, int n)
{
var yScale = pane.YAxis.Scale;
double yMin = yScale.Min;
double yMax = yScale.Max;
var line = new LineObj(x, yMin, x, yMax) { IsClippedToChartRect = true };
//line.Line.Style = System.Drawing.Drawing2D.DashStyle.Dash;
line.Line.Color = Color.DarkGreen;
pane.GraphObjList.Add(line);
if (n > 0) {
var text = new TextObj(n.ToString(), x, yMax - 0.02 * (yMax - yMin)) { IsClippedToChartRect = true };
text.FontSpec.Border.IsVisible = true;
pane.GraphObjList.Add(text);
}
}
示例6: RenderLegend
/// <summary>
/// Render legend
/// </summary>
/// <param name="gp"></param>
/// <param name="dataResults"></param>
protected override void RenderLegend(GraphPane gp, IEnumerable<RequestDataResults> dataResults)
{
int fontSize = 6;
int offset = 0;
int unit = (int) gp.YAxis.Scale.Max/10;
// Average time
var avgLegendBox = new BoxObj(-4, unit, 1, unit)
{
Fill = new Fill(Color.FromArgb(75, Color.YellowGreen))
};
gp.GraphObjList.Add(avgLegendBox);
var avgLegendText = new TextObj("125", -3.5, (double)unit / 2).Style(Color.Black, fontSize);
gp.GraphObjList.Add(avgLegendText);
var avgLegendLabel = new TextObj("Average time", -4, (double)unit / 2).Style(Color.Black, fontSize, AlignH.Right);
gp.GraphObjList.Add(avgLegendLabel);
offset += unit*2;
// Min/Max
var minMaxLine = new LineObj(Color.Black, -3.5, offset, -3.5, offset + 2*unit);
gp.GraphObjList.Add(minMaxLine);
var minMaxLabel = new TextObj("Min/Max", -4, offset + unit).Style(Color.Black, fontSize, AlignH.Right);
gp.GraphObjList.Add(minMaxLabel);
offset += 3*unit;
// Min/Max excluding extreme deciles
var minMaxExclLine = new LineObj(Color.Black, -3.5, offset, -3.5, offset + 2*unit);
minMaxExclLine.Line.Width = 3;
minMaxExclLine.Line.Color = Color.DarkGray;
gp.GraphObjList.Add(minMaxExclLine);
var avgExclLine = new LineObj(Color.Black, -3.8, offset + unit, -3.2, offset + unit);
avgExclLine.Line.Width = 3;
avgExclLine.Line.Color = Color.DarkGray;
gp.GraphObjList.Add(avgExclLine);
var avgExclLabel1 = new TextObj("Min/Max/Avg", -4, offset + 1.2 *unit).Style(Color.Black, fontSize, AlignH.Right);
gp.GraphObjList.Add(avgExclLabel1);
var avgExclLabel2 = new TextObj("excluding extremes", -4, offset + 0.8 * unit).Style(Color.Black, fontSize, AlignH.Right);
gp.GraphObjList.Add(avgExclLabel2);
}
示例7: GetLabelBounds
public RectangleF GetLabelBounds(TextObj textObj, GraphPane graphPane, Graphics graphics)
{
SizeF size;
lock (_textBoxSizes)
{
var label = new Label {Text = textObj.Text, FontSize = textObj.FontSpec.Size};
if (!_textBoxSizes.TryGetValue(label, out size))
{
const float scaleFactor = 1.0f;
// This is a really expensive call, so we're caching its result across threads.
var coords = textObj.FontSpec.GetBox(
graphics, textObj.Text, 0, 0,
textObj.Location.AlignH, textObj.Location.AlignV, scaleFactor, new SizeF());
// Turn four points into a size.
var min = coords[0];
var max = min;
for (int i = 1; i < coords.Length; i++)
{
var point = coords[i];
if (min.X > point.X)
min.X = point.X;
if (min.Y > point.Y)
min.Y = point.Y;
if (max.X < point.X)
max.X = point.X;
if (max.Y < point.Y)
max.Y = point.Y;
}
size = new SizeF(max.X - min.X, max.Y - min.Y);
// Cache the result.
_textBoxSizes[label] = size;
}
}
PointF pix = textObj.Location.Transform(graphPane);
return new RectangleF(pix, size);
}
示例8: GenerateGraphData
void GenerateGraphData()
{
PointPairList stab = new PointPairList();
stab.Add(0, MainV2.comPort.MAV.param["IM_STAB_COL_1"].Value);
stab.Add(40, MainV2.comPort.MAV.param["IM_STAB_COL_2"].Value);
stab.Add(60, MainV2.comPort.MAV.param["IM_STAB_COL_3"].Value);
stab.Add(100, MainV2.comPort.MAV.param["IM_STAB_COL_4"].Value);
PointPairList acro = new PointPairList();
double _acro_col_expo = MainV2.comPort.MAV.param["IM_ACRO_COL_EXP"].Value;
// 100 point curve
for (int a = 0; a <= 100; a++)
{
double col_in = (a-50.0)/50.0;
double col_in3 = col_in*col_in*col_in;
double col_out = (_acro_col_expo*col_in3) + ((1 - _acro_col_expo)*col_in);
double acro_col_out = 500 + col_out*500;
acro.Add(a, acro_col_out);
}
zedGraphControl1.GraphPane.CurveList.Clear();
zedGraphControl1.GraphPane.GraphObjList.Clear();
var myCurve = zedGraphControl1.GraphPane.AddCurve("Stabalize Collective", stab, Color.DodgerBlue, SymbolType.Circle);
foreach (PointPair pp in stab)
{
// Add a another text item to to point out a graph feature
TextObj text = new TextObj(pp.X.ToString(), pp.X, pp.Y);
// rotate the text 90 degrees
text.FontSpec.Angle = 0;
text.FontSpec.FontColor = Color.White;
// Align the text such that the Right-Center is at (700, 50) in user scale coordinates
text.Location.AlignH = AlignH.Right;
text.Location.AlignV = AlignV.Center;
// Disable the border and background fill options for the text
text.FontSpec.Fill.IsVisible = false;
text.FontSpec.Border.IsVisible = false;
zedGraphControl1.GraphPane.GraphObjList.Add(text);
}
zedGraphControl1.GraphPane.AddCurve("Acro Collective", acro, Color.Yellow, SymbolType.None);
double posx = map(MainV2.comPort.MAV.cs.ch6out, MainV2.comPort.MAV.param["H_COL_MIN"].Value,
MainV2.comPort.MAV.param["H_COL_MAX"].Value, 0, 100);
// set current marker
var m_cursorLine = new LineObj(Color.Black, posx, 0, posx, 1);
m_cursorLine.Location.CoordinateFrame = CoordType.XScaleYChartFraction; // This do the trick !
m_cursorLine.IsClippedToChartRect = true;
m_cursorLine.Line.Style = System.Drawing.Drawing2D.DashStyle.Dash;
m_cursorLine.Line.Width = 2f;
m_cursorLine.Line.Color = Color.Red;
m_cursorLine.ZOrder = ZOrder.E_BehindCurves;
zedGraphControl1.GraphPane.GraphObjList.Add(m_cursorLine);
try
{
//zedGraphControl1.AxisChange();
}
catch
{
}
// Force a redraw
zedGraphControl1.Invalidate();
}
示例9: TextObj
/// <summary>
/// The Copy Constructor
/// </summary>
/// <param name="rhs">The <see cref="TextObj"/> object from which to copy</param>
public TextObj( TextObj rhs )
: base(rhs)
{
_text = rhs.Text;
_fontSpec = new FontSpec( rhs.FontSpec );
}
示例10: ZedGraphWebStatistic_RenderGraph
//.........这里部分代码省略.........
for (int i = 0; i < statistic.Length; i++)
{
textLabels[i] = statistic[i].ToString();
}
graphPane.XAxis.Title.Text = staticTypeName;
graphPane.XAxis.MajorGrid.Color = WebConfig.GraphXAxisGridColor;
if (_statisticType > 0)
{
graphPane.XAxis.MajorTic.IsBetweenLabels = true;
graphPane.XAxis.Type = AxisType.Text;
graphPane.XAxis.Scale.TextLabels = textLabels;
}
graphPane.YAxis.Title.Text = StringDef.Count;
graphPane.YAxis.Scale.Min = 0;
graphPane.YAxis.MajorGrid.IsVisible = true;
graphPane.YAxis.MajorGrid.DashOff = 0;
graphPane.YAxis.MajorGrid.Color = Color.Gray;
graphPane.YAxis.MinorGrid.IsVisible = true;
graphPane.YAxis.MinorGrid.Color = Color.LightGray;
graphPane.YAxis.MinorGrid.DashOff = 0;
if (_chartType == ChartType.Bar)
{
graphPane.BarSettings.Type = BarType.Stack;
double[] counts = new double[infos.Length];
double[] types = new double[infos.Length];
for (int i = 0; i < infos.Length; i++)
{
StatisticInfo info = infos[i] as StatisticInfo;
counts[i] = info.Count;
types[i] = info.Type;
//添加数值标签
string lab = info.Count.ToString();
TextObj text = new TextObj(lab, i + 1, (float)(info.Count)); ;
text.Location.CoordinateFrame = CoordType.AxisXYScale;
text.FontSpec.Border.IsVisible = false;
text.FontSpec.Fill.IsVisible = false;
if (_statisticType == 0)
{
text.Location.AlignH = AlignH.Left;
text.Location.AlignV = AlignV.Center;
text.FontSpec.Angle = 90f;
}
else
{
text.Location.AlignH = AlignH.Center;
text.Location.AlignV = AlignV.Bottom;
}
graphPane.GraphObjList.Add(text);
}
//绘制柱子
BarItem barItem = graphPane.AddBar(StringDef.Count, types, counts, WebConfig.GraphColors[0]);
barItem.Bar.Fill = new Fill(WebConfig.GraphColors[0]);
}
else if (_chartType == ChartType.Line)
{
double[] counts = new double[infos.Length];
double[] types = new double[infos.Length];
for (int i = 0; i < infos.Length; i++)
{
StatisticInfo info = infos[i] as StatisticInfo;
counts[i] = info.Count;
types[i] = info.Type;
//添加数值标签
string lab = info.Count.ToString();
TextObj text = new TextObj(lab, i + 1, (float)(info.Count)); ;
text.Location.CoordinateFrame = CoordType.AxisXYScale;
text.FontSpec.Border.IsVisible = false;
text.FontSpec.Fill.IsVisible = false;
if (_statisticType == 0)
{
text.Location.AlignH = AlignH.Left;
text.Location.AlignV = AlignV.Center;
text.FontSpec.Angle = 90f;
}
else
{
text.Location.AlignH = AlignH.Center;
text.Location.AlignV = AlignV.Bottom;
}
graphPane.GraphObjList.Add(text);
}
//绘制线条
LineItem lineItem = graphPane.AddCurve("xxx", types, counts, WebConfig.GraphColors[1], SymbolType.None);
}
graphPane.AxisChange(g);
}
}
}
示例11: DrawLineTempGraph
private void DrawLineTempGraph(int n, double data)
{
double amountTime;
double.TryParse(n.ToString(), out amountTime);
if (zgcTemperature.GraphPane.CurveList.Count <= 0)
return;
LineItem curve = zgcTemperature.GraphPane.CurveList[0] as LineItem;
if (curve == null)
return;
IPointListEdit list = curve.Points as IPointListEdit;
if (list == null)
return;
list.Add(amountTime, data);
curve.Line.Width = lineWidth;
curve.Symbol.Fill.Type = FillType.Solid;
curve.Symbol.Size = pointWidth;
double time = (Environment.TickCount - tickStart) / 1000.0;
// Keep the X scale at a rolling 30 second interval, with one
// major step between the max X value an the end of the axis
Scale scale = zgcTemperature.GraphPane.XAxis.Scale;
if (time > scale.Max - scale.MajorStep)
{
scale.Max = time + scale.MajorStep;
scale.Min = scale.Max - 30.0;
}
int step = 0;
if (n < 20)
step = 1;
else
step = (int)(n / 20);
const double offset = 0.05;
// Draw Text Value
for (int i = n - 1; i < n; i += step)
{
PointPair pt = curve.Points[i];
TextObj text = new TextObj(pt.Y.ToString("f2"), pt.X, pt.Y + offset, CoordType.AxisXYScale, AlignH.Left, AlignV.Center);
text.ZOrder = ZOrder.A_InFront;
text.FontSpec.Size = 10;
text.FontSpec.Border.IsVisible = false;
text.FontSpec.Fill.IsVisible = false;
text.FontSpec.Angle = 45;
text.IsClippedToChartRect = true;
tempPane.GraphObjList.Add(text);
}
//// Draw a box item to highlight a value range
//BoxObj box = new BoxObj(0, 35, time*2, 10, Color.Empty, Color.FromArgb(150, Color.LightGreen));
//box.Fill = new Fill(Color.White, Color.FromArgb(200, Color.LightGreen), 45.0F);
//// Use the BehindGrid zorder to draw the highlight beneath the grid lines
//box.ZOrder = ZOrder.F_BehindGrid;
//tempPane.GraphObjList.Add(box);
zgcTemperature.AxisChange();
zgcTemperature.Invalidate();
}
示例12: Form1_Load
private void Form1_Load( object sender, EventArgs e )
{
// Get a reference to the GraphPane instance in the ZedGraphControl
GraphPane myPane = zg1.GraphPane;
// Set the titles and axis labels
myPane.Title.Text = "Demonstration of Dual Y Graph";
myPane.XAxis.Title.Text = "Time, Days";
myPane.YAxis.Title.Text = "Parameter A";
myPane.Y2Axis.Title.Text = "Parameter B";
// Make up some data points based on the Sine function
PointPairList list = new PointPairList();
PointPairList list2 = new PointPairList();
for ( double i = -2; i < 2; i+=0.1 )
{
double x = (double)i * 5.0;
//double y = Math.Sin( (double)i * Math.PI / 15.0 ) * 16.0;
double y = ((2 / (1 + Math.Exp( x))) - 1);
double y2 = y * 13.5;
list.Add( x, y );
list2.Add( x, y2 );
}
// Generate a red curve with diamond symbols, and "Alpha" in the legend
LineItem myCurve = myPane.AddCurve( "Alpha",
list, Color.Red, SymbolType.Diamond );
// Fill the symbols with white
myCurve.Symbol.Fill = new Fill( Color.White );
// Generate a blue curve with circle symbols, and "Beta" in the legend
myCurve = myPane.AddCurve( "Beta",
list2, Color.Blue, SymbolType.Circle );
// Fill the symbols with white
myCurve.Symbol.Fill = new Fill( Color.White );
// Associate this curve with the Y2 axis
myCurve.IsY2Axis = true;
// Show the x axis grid
myPane.XAxis.MajorGrid.IsVisible = true;
// Make the Y axis scale red
myPane.YAxis.Scale.FontSpec.FontColor = Color.Red;
myPane.YAxis.Title.FontSpec.FontColor = Color.Red;
// turn off the opposite tics so the Y tics don't show up on the Y2 axis
myPane.YAxis.MajorTic.IsOpposite = false;
myPane.YAxis.MinorTic.IsOpposite = false;
// Don't display the Y zero line
myPane.YAxis.MajorGrid.IsZeroLine = false;
// Align the Y axis labels so they are flush to the axis
myPane.YAxis.Scale.Align = AlignP.Inside;
// Manually set the axis range
myPane.YAxis.Scale.Min = -30;
myPane.YAxis.Scale.Max = 30;
// Enable the Y2 axis display
myPane.Y2Axis.IsVisible = true;
// Make the Y2 axis scale blue
myPane.Y2Axis.Scale.FontSpec.FontColor = Color.Blue;
myPane.Y2Axis.Title.FontSpec.FontColor = Color.Blue;
// turn off the opposite tics so the Y2 tics don't show up on the Y axis
myPane.Y2Axis.MajorTic.IsOpposite = false;
myPane.Y2Axis.MinorTic.IsOpposite = false;
// Display the Y2 axis grid lines
myPane.Y2Axis.MajorGrid.IsVisible = true;
// Align the Y2 axis labels so they are flush to the axis
myPane.Y2Axis.Scale.Align = AlignP.Inside;
// Fill the axis background with a gradient
myPane.Chart.Fill = new Fill( Color.White, Color.LightGray, 45.0f );
// Add a text box with instructions
TextObj text = new TextObj(
"Zoom: left mouse & drag\nPan: middle mouse & drag\nContext Menu: right mouse",
0.05f, 0.95f, CoordType.ChartFraction, AlignH.Left, AlignV.Bottom );
text.FontSpec.StringAlignment = StringAlignment.Near;
myPane.GraphObjList.Add( text );
// Enable scrollbars if needed
zg1.IsShowHScrollBar = true;
zg1.IsShowVScrollBar = true;
zg1.IsAutoScrollRange = true;
zg1.IsScrollY2 = true;
// OPTIONAL: Show tooltips when the mouse hovers over a point
zg1.IsShowPointValues = true;
zg1.PointValueEvent += new ZedGraphControl.PointValueHandler( MyPointValueHandler );
// OPTIONAL: Add a custom context menu item
zg1.ContextMenuBuilder += new ZedGraphControl.ContextMenuBuilderEventHandler(
MyContextMenuBuilder );
// OPTIONAL: Handle the Zoom Event
zg1.ZoomEvent += new ZedGraphControl.ZoomEventHandler( MyZoomEvent );
// Size the control to fit the window
SetSize();
// Tell ZedGraph to calculate the axis ranges
//.........这里部分代码省略.........
示例13: AddWebGraphItems
/// <summary>
/// Add the <see cref="ZedGraphWebGraphObj" /> objects defined in the webcontrol to
/// the <see cref="GraphPane" /> as <see cref="GraphObj" /> objects.
/// </summary>
/// <param name="g">The <see cref="Graphics" /> instance of interest.</param>
/// <param name="pane">The <see cref="GraphPane" /> object to receive the
/// <see cref="GraphObj" /> objects.</param>
protected void AddWebGraphItems( Graphics g, GraphPane pane )
{
try
{
ZedGraphWebGraphObj draw;
for ( int i = 0; i < GraphObjList.Count; i++ )
{
draw = GraphObjList[i];
if ( draw is ZedGraphWebTextObj )
{
ZedGraphWebTextObj item = (ZedGraphWebTextObj)draw;
TextObj x = new TextObj();
item.CopyTo( x );
pane.GraphObjList.Add( x );
}
else if ( draw is ZedGraphWebArrowObj )
{
ZedGraphWebArrowObj item = (ZedGraphWebArrowObj)draw;
ArrowObj x = new ArrowObj();
item.CopyTo( x );
pane.GraphObjList.Add( x );
}
else if ( draw is ZedGraphWebImageObj )
{
ZedGraphWebImageObj item = (ZedGraphWebImageObj)draw;
ImageObj x = new ImageObj();
item.CopyTo( x );
pane.GraphObjList.Add( x );
}
else if ( draw is ZedGraphWebBoxObj )
{
ZedGraphWebBoxObj item = (ZedGraphWebBoxObj)draw;
BoxObj x = new BoxObj();
item.CopyTo( x );
pane.GraphObjList.Add( x );
}
else if ( draw is ZedGraphWebEllipseObj )
{
ZedGraphWebEllipseObj item = (ZedGraphWebEllipseObj)draw;
EllipseObj x = new EllipseObj();
item.CopyTo( x );
pane.GraphObjList.Add( x );
}
}
}
catch ( Exception )
{
}
}
示例14: CreateGraph
/// <summary>
/// Create the heat map or single scan graph.
/// </summary>
private void CreateGraph()
{
if (_msDataFileScanHelper.MsDataSpectra == null)
return;
GraphPane.CurveList.Clear();
GraphPane.GraphObjList.Clear();
bool hasDriftDimension = _msDataFileScanHelper.MsDataSpectra.Length > 1;
bool useHeatMap = hasDriftDimension && !Settings.Default.SumScansFullScan;
filterBtn.Visible = spectrumBtn.Visible = hasDriftDimension;
graphControl.IsEnableVPan = graphControl.IsEnableVZoom = useHeatMap;
GraphPane.Legend.IsVisible = useHeatMap;
if (hasDriftDimension)
{
// Is there actually any drift time filtering available?
double minDriftTime, maxDriftTime;
_msDataFileScanHelper.GetDriftRange(out minDriftTime, out maxDriftTime, ChromSource.unknown); // Get range of drift times for all products and precursors
if ((minDriftTime == double.MinValue) && (maxDriftTime == double.MaxValue))
{
filterBtn.Visible = false;
filterBtn.Checked = false;
}
}
if (useHeatMap)
{
ZoomYAxis(); // Call this again now that cues are there to indicate need for drift scale
CreateDriftTimeHeatmap();
}
else
{
CreateSingleScan();
}
// Add extraction boxes.
for (int i = 0; i < _msDataFileScanHelper.ScanProvider.Transitions.Length; i++)
{
var transition = _msDataFileScanHelper.ScanProvider.Transitions[i];
if (transition.Source != _msDataFileScanHelper.Source)
continue;
var color1 = Blend(transition.Color, Color.White, 0.60);
var color2 = Blend(transition.Color, Color.White, 0.95);
var extractionBox = new BoxObj(
transition.ProductMz - transition.ExtractionWidth.Value / 2,
0.0,
transition.ExtractionWidth.Value,
1.0,
Color.Transparent,
transition.Color,
Color.White)
{
Location = { CoordinateFrame = CoordType.XScaleYChartFraction },
ZOrder = ZOrder.F_BehindGrid,
Fill = new Fill(color1, color2, 90),
IsClippedToChartRect = true,
};
GraphPane.GraphObjList.Add(extractionBox);
}
// Add labels.
for (int i = 0; i < _msDataFileScanHelper.ScanProvider.Transitions.Length; i++)
{
var transition = _msDataFileScanHelper.ScanProvider.Transitions[i];
if (transition.Source != _msDataFileScanHelper.Source)
continue;
var label = new TextObj(transition.Name, transition.ProductMz, 0.02, CoordType.XScaleYChartFraction, AlignH.Center, AlignV.Top)
{
ZOrder = ZOrder.D_BehindAxis,
IsClippedToChartRect = true,
Tag = i
};
label.FontSpec.Border.IsVisible = false;
label.FontSpec.FontColor = Blend(transition.Color, Color.Black, 0.30);
label.FontSpec.IsBold = true;
label.FontSpec.Fill = new Fill(Color.FromArgb(180, Color.White));
GraphPane.GraphObjList.Add(label);
}
double retentionTime = _msDataFileScanHelper.MsDataSpectra[0].RetentionTime ?? _msDataFileScanHelper.ScanProvider.Times[_msDataFileScanHelper.ScanIndex];
GraphPane.Title.Text = string.Format(Resources.GraphFullScan_CreateGraph__0_____1_F2__min_, _msDataFileScanHelper.FileName, retentionTime);
FireSelectedScanChanged(retentionTime);
}
示例15: Draw
public override void Draw(Graphics g)
{
GraphObjList.Clear();
if (_graphData != null)
{
// Force Axes to recalculate to ensure proper layout of labels
AxisChange(g);
// Reposition the regression label.
RectangleF rectChart = Chart.Rect;
PointF ptTop = rectChart.Location;
// Setup axes scales to enable the ReverseTransform method
XAxis.Scale.SetupScaleData(this, XAxis);
YAxis.Scale.SetupScaleData(this, YAxis);
float yNext = ptTop.Y;
double left = XAxis.Scale.ReverseTransform(ptTop.X + 8);
FontSpec fontSpec = GraphSummary.CreateFontSpec(COLOR_LINE_REGRESSION);
if (_labelRegression != null)
{
// Add regression text
double top = YAxis.Scale.ReverseTransform(yNext);
TextObj text = new TextObj(_labelRegression, left, top,
CoordType.AxisXYScale, AlignH.Left, AlignV.Top)
{
IsClippedToChartRect = true,
ZOrder = ZOrder.E_BehindCurves,
FontSpec = fontSpec,
};
// text.FontSpec.Size = 12;
GraphObjList.Add(text);
}
if (_labelRegressionCurrent != null)
{
// Add text for current regression
SizeF sizeLabel = fontSpec.MeasureString(g, _labelRegression, CalcScaleFactor());
yNext += sizeLabel.Height + 3;
double top = YAxis.Scale.ReverseTransform(yNext);
TextObj text = new TextObj(_labelRegressionCurrent, left, top,
CoordType.AxisXYScale, AlignH.Left, AlignV.Top)
{
IsClippedToChartRect = true,
ZOrder = ZOrder.E_BehindCurves,
FontSpec = GraphSummary.CreateFontSpec(COLOR_LINE_REGRESSION_CURRENT),
};
// text.FontSpec.Size = 12;
GraphObjList.Add(text);
}
}
base.Draw(g);
}