本文整理汇总了C#中Visifire.Charts.Chart类的典型用法代码示例。如果您正苦于以下问题:C# Chart类的具体用法?C# Chart怎么用?C# Chart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Chart类属于Visifire.Charts命名空间,在下文中一共展示了Chart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateChart
public Chart CreateChart(ChartInformation ci)
{
Chart m_chart = new Chart();
m_chart.BorderThickness = ci.m_BorderThickness;
m_chart.Theme = ci.m_Theme;
m_chart.View3D = ci.m_View3D;
Axis m_axisX = new Axis();
m_axisX.Title = ci.m_axisXTitle;
m_chart.AxesX.Add(m_axisX);
Axis m_asixY = new Axis();
m_asixY.Title = ci.m_axisYTitle;
m_asixY.Enabled = true;
m_asixY.StartFromZero = true;
m_asixY.AxisType = AxisTypes.Primary;
m_asixY.AxisMaximum = ci.m_axisYMaximum;
m_asixY.Interval = ci.m_axisYInterval;
m_chart.AxesY.Add(m_asixY);
for(int i = 0;i<ci.dsc.Count;i++)
{
DataSeries ds = new DataSeries();
ds.LegendText = ci.dsc[i].LegendText;
ds.RenderAs = ci.dsc[i].RenderAs;
ds.AxisYType = ci.dsc[i].AxisYType;
ds.DataPoints = new DataPointCollection(ci.dsc[i].DataPoints);
m_chart.Series.Add(ds);
}
m_chart.Rendered+=new EventHandler(chart_Rendered);
return m_chart;
}
示例2: TestDateTimeWithTwoDataPoints
public void TestDateTimeWithTwoDataPoints()
{
Chart chart = new Chart();
chart.Width = 500;
chart.Height = 300;
_isLoaded = false;
chart.Loaded += new RoutedEventHandler(chart_Loaded);
Random rand = new Random();
TestPanel.Children.Add(chart);
EnqueueConditional(() => { return _isLoaded; });
EnqueueDelay(_sleepTime);
EnqueueCallback(() =>
{
DataSeries dataSeries = new DataSeries();
dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 1, 1), YValue = rand.Next(10, 100) });
dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 1, 2), YValue = rand.Next(10, 100) });
chart.Series.Add(dataSeries);
});
EnqueueCallback(() =>
{
Assert.AreEqual(2, chart.Series[0].DataPoints.Count);
});
EnqueueDelay(_sleepTime);
EnqueueTestComplete();
}
示例3: TestingTitleBackgroundPropertyChanged
public void TestingTitleBackgroundPropertyChanged()
{
Chart chart = new Chart();
chart.Width = 500;
chart.Height = 300;
Common.CreateAndAddDefaultDataSeries(chart);
Title title = new Title();
title.Text = "Title1";
title.FontSize = 15;
title.VerticalAlignment = VerticalAlignment.Top;
title.HorizontalAlignment = HorizontalAlignment.Center;
title.Background = new SolidColorBrush(Colors.Magenta);
chart.Titles.Add(title);
chart.Loaded += new RoutedEventHandler(chart_Loaded);
TestPanel.Children.Add(chart);
EnqueueConditional(() => { return _isLoaded; });
EnqueueDelay(_sleepTime);
title.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e)
=>
{
Assert.AreEqual("Background", e.PropertyName);
};
EnqueueCallback(() => title.Background = new SolidColorBrush(Colors.Yellow));
EnqueueTestComplete();
}
示例4: OrientationDefaultValue
public void OrientationDefaultValue()
{
Chart chart = new Chart();
chart.Width = 500;
chart.Height = 300;
Common.CreateAndAddDefaultDataSeries(chart);
TrendLine trendLine = TrendLineToTest;
chart.TrendLines.Add(trendLine);
_isLoaded = false;
chart.Loaded += new RoutedEventHandler(chart_Loaded);
Window window = new Window();
window.Content = chart;
window.Show();
if (_isLoaded)
{
Assert.AreEqual(Orientation.Horizontal, trendLine.Orientation);
}
window.Dispatcher.InvokeShutdown();
window.Close();
}
示例5: LineThicknessDefaultValue
public void LineThicknessDefaultValue()
{
Chart chart = new Chart();
chart.Width = 500;
chart.Height = 300;
Common.CreateAndAddDefaultDataSeries(chart);
ChartGrid grid = new ChartGrid();
Axis axis = new Axis();
axis.Grids.Add(grid);
chart.AxesY.Add(axis);
_isLoaded = false;
chart.Loaded += new RoutedEventHandler(chart_Loaded);
Window window = new Window();
window.Content = chart;
window.Show();
if (_isLoaded)
{
Assert.AreEqual(0.25, grid.LineThickness);
}
window.Dispatcher.InvokeShutdown();
window.Close();
}
示例6: barGraph_Click
//柱状图
private void barGraph_Click(object sender, RoutedEventArgs e)
{
graphContainer.Children.Clear();
Chart chart = new Chart();
chart.Watermark = false;
chart.View3D = true;
chart.Width = 300;
chart.Height = 200;
Title title = new Title();
title.Text = "人口类别统计图";
chart.Titles.Add(title);
for (int i = 0; i < 8; i++)
{
DataSeries dataSeries = new DataSeries();
dataSeries.ShowInLegend = false;
dataSeries.RenderAs = RenderAs.Column;
for (int loopIndex = 0; loopIndex < 3; loopIndex++)
{
DataPoint dataPoint = new DataPoint();
dataPoint.AxisXLabel = pop[loopIndex];
dataPoint.YValue = points[i, loopIndex];
dataSeries.DataPoints.Add(dataPoint);
}
chart.Series.Add(dataSeries);
}
//将柱状图添加到 Grid 控件以固定位置
graphContainer.VerticalAlignment = VerticalAlignment.Top;
graphContainer.HorizontalAlignment = HorizontalAlignment.Left;
graphContainer.Children.Add(chart);
}
示例7: BackgroundDefaultValue
//[Ignore, Bug("Visifire")]
public void BackgroundDefaultValue()
{
Chart chart = new Chart();
chart.Width = 400;
chart.Height = 300;
Common.CreateAndAddDefaultDataSeries(chart);
Title title = new Title();
chart.Titles.Add(title);
_isLoaded = false;
chart.Loaded += new RoutedEventHandler(chart_Loaded);
Window window = new Window();
window.Content = chart;
window.Show();
if (_isLoaded)
{
Common.AssertBrushesAreEqual(new SolidColorBrush(Colors.Transparent), chart.Titles[0].Background);
}
window.Dispatcher.InvokeShutdown();
window.Close();
}
示例8: SolidColorBrush
SolidColorBrush twoSDBrush = new SolidColorBrush(Color.FromArgb(50,3, 3, 247)); //平均曲线颜色,红色
#endregion Fields
#region Constructors
public PageAvgCurve()
{
InitializeComponent();
chart1 = new Chart();
chart2 = new Chart();
chart2.ScrollingEnabled = chart1.ScrollingEnabled = false;
chart1.BorderThickness = chart2.BorderThickness = new Thickness(0, 0, 0, 0);
Axis yOACAxis = new Axis();
Axis yEACAxis = new Axis();
yOACAxis.Suffix = yEACAxis.Suffix = "(Nm)";
chart1.AxesY.Add(yOACAxis);
chart2.AxesY.Add(yEACAxis);
Axis xAxisOAC = new Axis();
Axis xAxisEAC = new Axis();
xAxisEAC.AxisMinimum = xAxisOAC.AxisMinimum = 0;
xAxisOAC.AxisMaximum = xAxisEAC.AxisMaximum = 100;
xAxisEAC.Suffix = xAxisOAC.Suffix = "%";
chart1.AxesX.Add(xAxisOAC);
chart2.AxesX.Add(xAxisEAC);
grid1.Children.Add(chart1);
grid2.Children.Add(chart2);
}
示例9: CheckDefaultLineThickness
public void CheckDefaultLineThickness()
{
Chart chart = new Chart();
chart.Width = 500;
chart.Height = 300;
Common.CreateAndAddDefaultDataSeries(chart);
Ticks tick = new Ticks();
Axis axis = new Axis();
axis.Ticks.Add(tick);
chart.AxesX.Add(axis);
_isLoaded = false;
chart.Loaded += new RoutedEventHandler(chart_Loaded);
Window window = new Window();
window.Content = chart;
window.Show();
if (_isLoaded)
{
Assert.AreEqual(0.5, tick.LineThickness);
}
window.Dispatcher.InvokeShutdown();
window.Close();
}
示例10: TestDateTimeWithTwoDataPoints
public void TestDateTimeWithTwoDataPoints()
{
Chart chart = new Chart();
chart.Width = 500;
chart.Height = 300;
_isLoaded = false;
chart.Loaded += new RoutedEventHandler(chart_Loaded);
Random rand = new Random();
DataSeries dataSeries = new DataSeries();
dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 1, 1), YValue = rand.Next(10, 100) });
dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 1, 2), YValue = rand.Next(10, 100) });
chart.Series.Add(dataSeries);
Window window = new Window();
window.Content = chart;
window.Show();
if (_isLoaded)
{
Assert.AreEqual(2, chart.Series[0].DataPoints.Count);
window.Dispatcher.InvokeShutdown();
window.Close();
}
}
示例11: CorrectDataWindow
public CorrectDataWindow()
{
InitializeComponent();
chart = new Chart();
chart.BorderThickness = new Thickness(0, 0, 1, 0);
tlEnd.LineThickness= tlStart.LineThickness = 1.5;
tlSelectedPoint.LineThickness = 0.5;
tlEnd.LineColor=tlEnd.LabelFontColor= tlStart.LineColor = tlStart.LabelFontColor = new SolidColorBrush(Colors.Green);
tlSelectedPoint.LineColor = tlSelectedPoint.LabelFontColor = new SolidColorBrush(Colors.Black);
tlEnd.Background= tlStart.Background = null;
tlEnd.Orientation= tlSelectedPoint.Orientation = tlStart.Orientation = Orientation.Vertical;
tlStart.LabelText = "起点";
tlEnd.LabelText = "终点";
MenuItem miGroup1 = new MenuItem();
miGroup1.Header = "测试起终点判定";
MenuItem miGroup2 = new MenuItem();
miGroup2.Header = "数据平滑处理";
MenuItem miGroup3 = new MenuItem();
miGroup3.Header = "单次起终点校准";
miSetStart.Header = "设为测试起点";
miSetEnd.Header = "设为测试终点";
miGroup1.Items.Add(miSetStart);
miGroup1.Items.Add(miSetEnd);
miCheckStart.Header = "设为平滑处理起点";
miCheckEnd.Header = "设为平滑处理终点";
miGroup2.Items.Add(miCheckStart);
miGroup2.Items.Add(miCheckEnd);
miNextStart = new MenuItem();
miNextStart.Header = "设为下一次起点";
miPreEnd = new MenuItem();
miPreEnd.Header = "设为上一次终点";
miGroup3.Items.Add(miNextStart);
miGroup3.Items.Add(miPreEnd);
dpMenu.Items.Add(miGroup1);
Separator sp = new Separator();
dpMenu.Items.Add(sp);
dpMenu.Items.Add(miGroup2);
Separator sp1 = new Separator();
dpMenu.Items.Add(sp1);
dpMenu.Items.Add(miGroup3);
miSetStart.Click += new RoutedEventHandler(miSetStart_Click);
miSetEnd.Click += btnSetEnd_Click;
miCheckStart.Click += new RoutedEventHandler(checkStart_Click);
miCheckEnd.Click += new RoutedEventHandler(checkEnd_Click);
miPreEnd.Click += new RoutedEventHandler(miPreEnd_Click);
miNextStart.Click += new RoutedEventHandler(miNextStart_Click);
}
示例12: ShowAvgCurveWindow
public ShowAvgCurveWindow()
{
InitializeComponent();
chart1 = new Chart();
chart2 = new Chart();
chart2.ScrollingEnabled = chart1.ScrollingEnabled = false;
grid1.Children.Add(chart1);
grid2.Children.Add(chart2);
}
示例13: switch
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.chartC = ((Visifire.Charts.Chart)(target));
return;
}
this._contentLoaded = true;
}
示例14: AvgCurveCompareWindow
public AvgCurveCompareWindow()
{
InitializeComponent();
WindowHelper.RepairWindowBehavior(this);
dictBLL = new BLL.TB_Dict();
chartOdd = new Chart();
chartEven = new Chart();
}
示例15: DataPointDecimalXValueChecking
public void DataPointDecimalXValueChecking()
{
Chart chart = new Chart();
chart.Width = 500;
chart.Height = 300;
Axis axisX = new Axis();
axisX.Interval = 1;
chart.AxesX.Add(axisX);
_isLoaded = false;
chart.Loaded += new RoutedEventHandler(chart_Loaded);
Random rand = new Random();
DataSeries dataSeries1 = new DataSeries();
List<Double> xList = new List<Double>();
List<Double> yList = new List<Double>();
Double y = 0;
for (Double i = 0; i < 10; i++)
{
DataPoint dataPoint = new DataPoint();
dataPoint.XValue = i + 1;
xList.Add(i);
dataPoint.YValue = (y = rand.Next(-100, 100));
yList.Add(y);
dataSeries1.DataPoints.Add(dataPoint);
}
chart.Series.Add(dataSeries1);
DataSeries dataSeries2 = new DataSeries();
dataSeries2.RenderAs = RenderAs.Column;
Double j = 0.5;
for (Int32 i = 0; i < 10; i++)
{
DataPoint dataPoint = new DataPoint();
dataPoint.XValue = j;
dataPoint.YValue = yList[i];
dataSeries2.DataPoints.Add(dataPoint);
j++;
}
chart.Series.Add(dataSeries2);
Window window = new Window();
window.Content = chart;
window.Show();
if (_isLoaded)
{
window.Dispatcher.InvokeShutdown();
window.Close();
}
}