本文整理汇总了C#中ZedGraph.GraphPane.AddHiLowBar方法的典型用法代码示例。如果您正苦于以下问题:C# GraphPane.AddHiLowBar方法的具体用法?C# GraphPane.AddHiLowBar怎么用?C# GraphPane.AddHiLowBar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.GraphPane
的用法示例。
在下文中一共展示了GraphPane.AddHiLowBar方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateDiaryGraph
private void CreateDiaryGraph(GraphPane gp, string filepath, string title, int y)
{
gp.BarSettings.Base = BarBase.Y;
gp.BarSettings.Type = BarType.Overlay;
PointPairList labelList = new PointPairList();
string[] values = FileReadWrite.ReadLinesFromFile(filepath);
for (int i = 0; i < values.Length; i++)
{
try
{
string[] split = values[i].Split(',');
DateTime dtStart = DateTime.Parse(split[0]);
double startx = (double)new XDate(dtStart);
if (split[1].Length > 0)
{
#region END DATE
DateTime dtEnd = DateTime.Parse(split[1]);
double endx = (double)new XDate(dtEnd);
#endregion
#region COLOR OF BAR
string color = "black";
bool isSolid = false;
if ((split.Length > 2) && (split[2].Length > 0))
{
color = split[2];
isSolid = true;
}
#endregion
#region LABEL AND POINT
string label = "";
for (int c = 3; c < split.Length; c++)
{
label += split[c].Replace("_", ", ").Replace("-", " ").Trim(',',' ') + "\n ";
}
labelList = new PointPairList();
labelList.Add(endx, y, startx, String.Format("{3} {0}-{1}\n,{2}",dtStart.ToShortTimeString(),dtEnd.ToShortTimeString(),label,title));
#endregion
#region ADD BAR
HiLowBarItem myBar = gp.AddHiLowBar(title, labelList, Color.FromName(color));
if (isSolid) myBar.Bar.Fill.Type = FillType.Solid;
else myBar.Bar.Fill.Type = FillType.None;
#endregion
}
}
catch { }
}
}
示例2: CreateDiaryGraph
private void CreateDiaryGraph(GraphPane gp, string filepath, string dirpath_colors,
string title, int yoffset, string type)
{
gp.BarSettings.Base = BarBase.Y;
gp.BarSettings.ClusterScaleWidth = 200.0;
gp.BarSettings.Type = BarType.Overlay;
PointPairList labelList = new PointPairList();
if (filepath.Contains(".csv"))
{
string[] values = FileReadWrite.ReadLinesFromFile(filepath);
for (int i = 1; i < values.Length; i++)
{
try
{
string[] split = values[i].Split(',');
DateTime dtStart = DateTime.MinValue;
DateTime dtEnd = DateTime.MaxValue;
double startx = 0;
double endx = 0;
if (split.Length > 0 && split[0].Length > 0)
{
dtStart = DateTimeParse(split[0]);
startx = (double)new XDate(dtStart);
}
if (split.Length > 1 && split[1].Length > 0)
{
dtEnd = DateTimeParse(split[1]);
endx = (double)new XDate(dtEnd);
}
Color color = Color.White;
bool isSolid = false;
string clabel = "";
if (startx >= startX && endx >= endX)
{
if (split.Length > 2 && split[2].Length > 0)
{
clabel = split[2];
if (!DataViewForm.annotationColorMap.ContainsKey(clabel))
DataViewForm.annotationColorMap.Add(clabel, DataViewForm._annotationColorPalette[DataViewForm.annotationColorMap.Count]);
color = DataViewForm.annotationColorMap[clabel];
isSolid = true;
labelList = new PointPairList();
labelList.Add(endx, yoffset, startx, String.Format("{3}: {0} - {1}\n {2}", dtStart.ToLongTimeString(), dtEnd.ToLongTimeString(), clabel, title));
HiLowBarItem myBar = gp.AddHiLowBar(title, labelList, color);
myBar.Bar.Border.IsVisible = false;
if (isSolid) myBar.Bar.Fill.Type = FillType.Solid;
else myBar.Bar.Fill.Type = FillType.None;
}
}
}
catch { }
}
}
else if (filepath.Contains(".xml"))
{
XmlDocument doc = new XmlDocument();
doc.Load(filepath);
XmlNodeList nodes = doc.GetElementsByTagName("ANNOTATION");
foreach (XmlNode xn in nodes)
{
try
{
DateTime dtStart = DateTimeParse(xn["START_DT"].InnerText);
DateTime dtEnd = DateTimeParse(xn["STOP_DT"].InnerText);
double startx = (double)new XDate(dtStart);
double endx = (double)new XDate(dtEnd);
Color color = Color.White;
bool isSolid = false;
string clabel = xn["LABEL"].InnerText;
if (startx >= (double)startX && endx >= (double)endX)
{
if (!DataViewForm.annotationColorMap.ContainsKey(clabel))
DataViewForm.annotationColorMap.Add(clabel, DataViewForm._annotationColorPalette[DataViewForm.annotationColorMap.Count]);
color = DataViewForm.annotationColorMap[clabel];
isSolid = true;
labelList = new PointPairList();
labelList.Add(endx, yoffset, startx, String.Format("{3}: {0} - {1}\n {2}", dtStart.ToLongTimeString(), dtEnd.ToLongTimeString(), clabel, title));
HiLowBarItem myBar = gp.AddHiLowBar(title, labelList, color);
myBar.Bar.Border.IsVisible = false;
if (isSolid) myBar.Bar.Fill.Type = FillType.Solid;
else myBar.Bar.Fill.Type = FillType.None;
}
}
catch { }
}
}
}
示例3: initializeGraphControl
private void initializeGraphControl (ZedGraphControl zedGraphControl)
{
zedGraphControl.MasterPane.PaneList.Clear();
zedGraphControl.MasterPane.SetLayout(zedGraphControl.CreateGraphics(), 1, (int) IonSeries.Count + 1);
zedGraphControl.MasterPane.InnerPaneGap = 0;
zedGraphControl.MasterPane.Border.IsVisible = true;
zedGraphControl.IsEnableHPan = false;
zedGraphControl.IsEnableHZoom = false;
zedGraphControl.IsSynchronizeYAxes = true;
zedGraphControl.IsZoomOnMouseCenter = true;
var axisPane = new GraphPane();
axisPane.Legend.IsVisible = false;
axisPane.IsFontsScaled = false;
axisPane.XAxis.IsVisible = false;
axisPane.YAxis.Scale.Min = 0;
axisPane.YAxis.Scale.Max = 100;
axisPane.YAxis.Title.Text = zedGraphControl.Text;
axisPane.YAxis.Title.Gap = 0.05f;
axisPane.YAxis.MajorTic.IsOpposite = false;
axisPane.YAxis.MinorTic.IsOpposite = false;
axisPane.Chart.Border.IsVisible = false;
axisPane.Border.IsVisible = false;
axisPane.Margin.Left = 1;
axisPane.Margin.Right = 0;
axisPane.Title.Text = "Series:";
zedGraphControl.MasterPane.Add(axisPane);
var csr = new ColorSymbolRotator();
for (int i = 0; i < (int) IonSeries.Count; ++i)
{
var graphPane = new GraphPane();
graphPane.Title.Text = IonSeriesLabels[i];
graphPane.Legend.IsVisible = false;
graphPane.IsFontsScaled = false;
graphPane.Chart.Border.IsVisible = false;
graphPane.Border.IsVisible = false;
graphPane.XAxis.Scale.Min = -1;
graphPane.XAxis.Scale.Max = 1;
graphPane.XAxis.IsVisible = false;
graphPane.YAxis.Scale.Min = 0;
graphPane.YAxis.Scale.Max = 100;
graphPane.YAxis.IsVisible = false;
zedGraphControl.MasterPane.Add(graphPane);
graphPane.BarSettings.Type = BarType.Overlay;
graphPane.BarSettings.ClusterScaleWidth = 1;
var mean = graphPane.AddCurve(IonSeriesLabels[i],
new PointPairList(),
Color.Black,
SymbolType.Circle);
mean.Line.IsVisible = false;
mean.Symbol.Border.IsVisible = false;
mean.Symbol.Fill.Type = FillType.Solid;
var errorBar = graphPane.AddErrorBar(IonSeriesLabels[i],
new PointPairList(),
Color.Black);
errorBar.Bar.IsVisible = true;
errorBar.Bar.PenWidth = .1f;
errorBar.Bar.Symbol.IsVisible = true;
errorBar.Bar.Symbol.Type = SymbolType.HDash;
errorBar.Bar.Symbol.Border.Width = .1f;
errorBar.Bar.Symbol.Size = 4;
var hiLowBar = graphPane.AddHiLowBar(IonSeriesLabels[i],
new PointPairList(),
Color.Black);
hiLowBar.Bar.Fill.Type = FillType.None;
var scatter = graphPane.AddCurve(IonSeriesLabels[i],
new PointPairList(),
csr.NextColor,
SymbolType.Circle);
scatter.Line.IsVisible = false;
scatter.Symbol.IsAntiAlias = true;
scatter.Symbol.Border.IsVisible = false;
scatter.Symbol.Fill.Type = FillType.Solid;
scatter.Symbol.Size = 3f;
}
zedGraphControl.MasterPane.AxisChange();
zedGraphControl.Refresh();
}
示例4: HiLowChart
public void HiLowChart()
{
// Create a new graph
testee = new GraphPane( new Rectangle( 40, 40, form2.Size.Width - 80, form2.Size.Height - 80 ),
"HiLow Chart Test ", "Date", "Y Value Range" );
double[] hi = new double[20];
double[] low = new double[20];
string[] x = new string[20];
for ( int i = 45; i < 65; i++ )
{
XDate date = (double)new XDate( 2004, 12, i - 30, 0, 0, 0 );
x[i - 45] = date.ToString( "d" );
if ( i % 2 == 1 )
hi[i - 45] = (double)i * 1.03;
else
hi[i - 45] = (double)i * .99;
low[i - 45] = .97 * hi[i - 45];
}
// HiLowBarItem myCurve = testee.AddHiLowBar( "My Curve",null,hi,low, Color.Green );
HiLowBarItem myCurve = testee.AddHiLowBar( "My Curve", null, hi, low, Color.Green );
testee.XAxis.Scale.FontSpec.Size = 8;
testee.XAxis.Scale.FontSpec.Angle = 60;
testee.XAxis.Scale.FontSpec.IsBold = true;
// Set the XAxis to Text type
testee.XAxis.Type = AxisType.Text;
testee.XAxis.Scale.TextLabels = x;
testee.XAxis.Scale.MajorStep = 1;
testee.XAxis.MajorTic.IsBetweenLabels = false;
testee.YAxis.MajorGrid.IsVisible = true;
testee.YAxis.MinorGrid.IsVisible = true;
form2.WindowState = FormWindowState.Maximized;
testee.AxisChange( form2.CreateGraphics() );
TestUtils.DelaySeconds( 3000 );
Assert.IsTrue( TestUtils.promptIfTestWorked( "Was a HiLow chart with a date X-Axis displayed?" ) );
}
示例5: Form1_Load
//.........这里部分代码省略.........
// Color color = Color.FromArgb( 123, 45, 67, 89 );
// HSBColor hsbColor = new HSBColor( color );
// Color color2 = hsbColor;
Random rand = new Random();
myPane = new GraphPane();
myPane.Title.Text = "My Title";
myPane.XAxis.Title.Text = "X Axis";
myPane.YAxis.Title.Text = "Y Axis";
//myPane.XAxis.Type = AxisType.Ordinal;
//myPane.XAxis.Type = AxisType.Date;
//myPane.ClusterScaleWidth = 0.75 / 1440.0;
//myPane.XAxis.MinorStep = 1;
//myPane.XAxis.MinorUnit = DateUnit.Minute;
PointPairList list1 = new PointPairList();
PointPairList list2 = new PointPairList();
for ( int i=1; i<10; i++ )
{
//double x = new XDate( 1995, 5, 10, 12, i+1, 0 );
double x = (double) i;
double y1 = rand.NextDouble() * 100.0;
double y2 = rand.NextDouble() * 100.0;
list1.Add( x-0.25, y1, 0 );
list2.Add( x+0.17, y2, 0 );
}
//myPane.AddCurve( "junk", list1, Color.Green );
HiLowBarItem bar1 = myPane.AddHiLowBar( "Bar 1", list1, Color.Red );
//bar1.Bar.Border.IsVisible = false;
bar1.Bar.Size = 15;
//bar1.Bar.Fill = new Fill( Color.Red );
HiLowBarItem bar2 = myPane.AddHiLowBar( "Bar 2", list2, Color.Blue );
//bar2.Bar.Border.IsVisible = false;
//bar2.Bar.Fill = new Fill( Color.Blue );
bar2.Bar.Size = 10;
MasterPane mPane = new MasterPane();
mPane.Add( myPane );
myPane.AxisChange( this.CreateGraphics() );
//this.CreateBarLabels(mPane);
#endif
#if false // bar test with no gap
myPane = new GraphPane( new Rectangle( 40, 40, 600, 300 ),
"Score Report", "", "" );
// Make up some random data points
string[] labels = { "" };
double[] y = { 800, 900 };
double[] y2 = { 500 };
// Generate a red bar with "Curve 1" in the legend
BarItem myBar = myPane.AddBar( null, y, null, Color.RoyalBlue );
// Generate a blue bar with "Curve 2" in the legend
myBar = myPane.AddBar( null, y2, null, Color.Red );
// Draw the X tics between the labels instead of at the labels
myPane.YAxis.IsTicsBetweenLabels = true;