本文整理汇总了C#中ChartArea类的典型用法代码示例。如果您正苦于以下问题:C# ChartArea类的具体用法?C# ChartArea怎么用?C# ChartArea使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChartArea类属于命名空间,在下文中一共展示了ChartArea类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Details
public ActionResult Details(int width = 500, int height = 500)
{
var chart = new Chart { Height = height, Width = width };
var chartArea = new ChartArea("Area1")
{
AxisX = { Interval = 1 },
Area3DStyle = { Enable3D = true },
BackColor = Color.Transparent
};
chart.ChartAreas.Add(chartArea);
chart.BackColor = Color.Transparent;
var seriescountAll = new Series("项目统计");
var countAll =
_iProjectInfoStateService.GetAll()
.Select(a => new { Key = a.ProjectInfoStateName, Count = a.ProjectInfos.Count(b => !b.Deleted) });
seriescountAll.ChartArea = "Area1";
seriescountAll.IsVisibleInLegend = true;
seriescountAll.IsValueShownAsLabel = true;
seriescountAll.Label = "#VALX #VALY";
seriescountAll.Points.DataBind(countAll, "Key", "Count", "");
seriescountAll.ChartType = SeriesChartType.Funnel;
chart.Series.Add(seriescountAll);
var imageStream = new MemoryStream();
chart.SaveImage(imageStream, ChartImageFormat.Png);
imageStream.Position = 0;
return new FileStreamResult(imageStream, "image/png");
}
开发者ID:b9502032,项目名称:MySite,代码行数:30,代码来源:ProjectInfoCountController.cs
示例2: BuildChart
public MemoryStream BuildChart(int? type, IDictionary<string, float> dataPoints)
{
// default to line
var chartType = type == null ? SeriesChartType.Line : (SeriesChartType)type;
var chart = new Chart();
// configure your chart area (dimensions, etc) here.
var area = new ChartArea();
chart.ChartAreas.Add(area);
TickMark tm = new TickMark();
// create and customize your data series.
var series = new Series();
foreach (var item in dataPoints)
{
series.Points.AddXY(item.Key, item.Value);
}
//series.Label = "#PERCENT{P0}";
series.Font = new Font("Segoe UI", 8.0f, FontStyle.Bold);
series.ChartType = chartType;
series["PieLabelStyle"] = "Outside";
chart.Series.Add(series);
var returnStream = new MemoryStream();
chart.ImageType = ChartImageType.Png;
chart.SaveImage(returnStream);
returnStream.Position = 0;
return returnStream;
}
开发者ID:seankenny,项目名称:NikNak,代码行数:33,代码来源:ChartingService.cs
示例3: CursorEventArgs
public CursorEventArgs(ChartArea chartArea, Axis axis, double newSelectionStart, double newSelectionEnd)
{
this.ChartArea = chartArea;
this.Axis = axis;
this.NewSelectionStart = newSelectionStart;
this.NewSelectionEnd = newSelectionEnd;
}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:CursorEventArgs.cs
示例4: ChartWindow
public ChartWindow(CandleSeries candleSeries)
{
InitializeComponent();
if (candleSeries.IsNull())
throw new ArgumentNullException("candleSeries");
_candleSeries = candleSeries;
_trader = MainWindow.Instance.Trader;
Chart.ChartTheme = "ExpressionDark";
var area = new ChartArea();
Chart.Areas.Add(area);
_candleElem = new ChartCandleElement
{
Antialiasing = false,
UpFillColor = Colors.White,
UpBorderColor = Colors.Black,
DownFillColor = Colors.Black,
DownBorderColor = Colors.Black,
};
area.Elements.Add(_candleElem);
_trader.NewCandles += ProcessNewCandles;
_trader.SubscribeCandles(_candleSeries, DateTime.Today - TimeSpan.FromTicks(((TimeSpan)candleSeries.Arg).Ticks * 100), DateTimeOffset.MaxValue);
}
开发者ID:reddream,项目名称:StockSharp,代码行数:29,代码来源:ChartWindow.xaml.cs
示例5: CreateColumnChartArea
public ChartArea CreateColumnChartArea()
{
ChartArea chartArea = new ChartArea();
chartArea.Name = "Result Chart";
chartArea.BackColor = Color.Transparent;
chartArea.AxisX.IsLabelAutoFit = false;
chartArea.AxisY.IsLabelAutoFit = false;
chartArea.AxisX.LabelStyle.Font =
new Font("Verdana,Arial,Helvetica,sans-serif",
8F, FontStyle.Regular);
chartArea.AxisY.LabelStyle.Font =
new Font("Verdana,Arial,Helvetica,sans-serif",
8F, FontStyle.Regular);
chartArea.AxisY.LineColor = Color.FromArgb(64, 64, 64, 64);
chartArea.AxisX.LineColor = Color.FromArgb(64, 64, 64, 64);
chartArea.AxisY.MajorGrid.LineColor = Color.FromArgb(64, 64, 64, 64);
chartArea.AxisX.MajorGrid.LineColor = Color.FromArgb(64, 64, 64, 64);
chartArea.AxisX.Interval = 1;
chartArea.AxisX.LabelStyle.Enabled = false;
chartArea.Position.Height = 80;
chartArea.Position.Width = 85;
chartArea.Position.X = 2;
chartArea.Position.Y = 14;
return chartArea;
}
开发者ID:pvthang810,项目名称:PsMModel,代码行数:25,代码来源:ChartExampleController.cs
示例6: ChartWindow
public ChartWindow(CandleSeries candleSeries, DateTime from, DateTime to)
{
InitializeComponent();
if (candleSeries == null)
throw new ArgumentNullException("candleSeries");
_candleSeries = candleSeries;
_trader = MainWindow.Instance.Trader;
Chart.ChartTheme = "ExpressionDark";
var area = new ChartArea();
Chart.Areas.Add(area);
_candleElem = new ChartCandleElement
{
Antialiasing = false,
UpFillColor = Colors.White,
UpBorderColor = Colors.Black,
DownFillColor = Colors.Black,
DownBorderColor = Colors.Black,
};
area.Elements.Add(_candleElem);
_trader.NewCandles += ProcessNewCandles;
_trader.SubscribeCandles(_candleSeries, from, to);
}
开发者ID:hbwjz,项目名称:StockSharp,代码行数:29,代码来源:ChartWindow.xaml.cs
示例7: CreateChart
public static void CreateChart(string imagePath,string name, IEnumerable<BenchResult> results, Func<BenchResult,double> selector)
{
Chart chart = new Chart();
chart.Width = 500;
chart.Height = 400;
chart.Titles.Add(name);
var area = new ChartArea("Default");
chart.ChartAreas.Add(area);
var series = new Series("Default");
chart.Series.Add(series);
area.AxisX.LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep90;
area.AxisX.LabelStyle.TruncatedLabels = false;
area.AxisX.Interval = 1;
series.ChartType = SeriesChartType.Column;
series.IsValueShownAsLabel = true;
series.XValueType = ChartValueType.String;
series.YValueType = ChartValueType.Int32;
foreach(var r in results.OrderBy( r => selector(r)))
{
DataPoint point = new DataPoint();
point.SetValueXY(r.Serializer.Replace("Adapter",""),(int)Math.Round(selector(r)));
point.AxisLabel = r.Serializer.Replace("Adapter", "");
series.Points.Add(point);
}
chart.SaveImage(imagePath, ChartImageFormat.Png);
}
开发者ID:etishor,项目名称:SerializationTests,代码行数:29,代码来源:ChartHelper.cs
示例8: HistoryCandlesWindow
public HistoryCandlesWindow(Security security)
{
if (security == null)
throw new ArgumentNullException("security");
_security = security;
InitializeComponent();
Title = _security.Code + LocalizedStrings.Str3747;
TimeFramePicker.ItemsSource = new[]
{
TimeSpan.FromMinutes(1),
TimeSpan.FromMinutes(5),
TimeSpan.FromMinutes(15),
TimeSpan.FromMinutes(60),
TimeSpan.FromDays(1),
TimeSpan.FromDays(7),
TimeSpan.FromTicks(TimeHelper.TicksPerMonth)
};
TimeFramePicker.SelectedIndex = 1;
DateFromPicker.Value = DateTime.Today.AddDays(-7);
DateToPicker.Value = DateTime.Today;
var area = new ChartArea();
_candlesElem = new ChartCandleElement();
area.Elements.Add(_candlesElem);
Chart.Areas.Add(area);
}
开发者ID:reddream,项目名称:StockSharp,代码行数:31,代码来源:HistoryCandlesWindow.xaml.cs
示例9: MainWindow
public MainWindow()
{
InitializeComponent();
_logManager.Listeners.Add(new GuiLogListener(LogControl));
_area = new ChartArea();
_chart.Areas.Add(_area);
}
开发者ID:vikewoods,项目名称:StockSharp,代码行数:9,代码来源:MainWindow.xaml.cs
示例10: MainWindow
public MainWindow()
{
InitializeComponent();
_area = new ChartArea();
Chart.Areas.Add(_area);
// попробовать сразу найти месторасположение Quik по запущенному процессу
Path.Text = QuikTerminal.GetDefaultPath();
}
开发者ID:reddream,项目名称:StockSharp,代码行数:10,代码来源:MainWindow.xaml.cs
示例11: ChartWindow
public ChartWindow()
{
InitializeComponent();
var area = new ChartArea();
Chart.Areas.Add(area);
_candlesElem = new ChartCandleElement();
area.Elements.Add(_candlesElem);
}
开发者ID:zjxbetter,项目名称:StockSharp,代码行数:10,代码来源:ChartWindow.xaml.cs
示例12: Details
public FileResult Details(int width = 1000, int height = 618)
{
var sysUserLog = _sysUserLogService.GetAllEnt();
var sysLog = _sysLogService.GetAllEnt();
var chart = new Chart { Height = height, Width = width };
var chartArea = new ChartArea("Area1") {AxisX = {Interval = 1}};
chart.ChartAreas.Add(chartArea);
var legend = new Legend();
chart.Legends.Add(legend);
var seriescountAll = new Series("使用次数");
var countAll =
sysUserLog.GroupBy(a => EntityFunctions.TruncateTime(a.CreatedDate))
.Select(a => new { Key = a.Key.Value, Count = a.Count() })
.OrderBy(a => a.Key);
seriescountAll.ChartArea = "Area1";
seriescountAll.IsVisibleInLegend = true;
seriescountAll.IsValueShownAsLabel = true;
seriescountAll.Points.DataBind(countAll, "Key", "Count", "");
seriescountAll.ChartType = SeriesChartType.Column;
chart.Series.Add(seriescountAll);
var seriescountUser = new Series("登陆用户数量");
var countUser =
sysUserLog.GroupBy(a => EntityFunctions.TruncateTime(a.CreatedDate)).Select(
a => new { Key = a.Key.Value, Count = a.Select(c => c.SysUserId).Distinct().Count() })
.OrderBy(a => a.Key);
seriescountUser.ChartArea = "Area1";
seriescountUser.IsVisibleInLegend = true;
seriescountUser.IsValueShownAsLabel = true;
seriescountUser.Points.DataBind(countUser, "Key", "Count", "");
seriescountUser.ChartType = SeriesChartType.Column;
chart.Series.Add(seriescountUser);
var seriessysLogChart = new Series("系统日志");
var sysLogChart =
sysLog.GroupBy(a => EntityFunctions.TruncateTime(a.CreatedDate))
.Select(a => new { Key = a.Key.Value, Count = a.Count() })
.OrderBy(a => a.Key);
seriessysLogChart.ChartArea = "Area1";
seriessysLogChart.IsVisibleInLegend = true;
seriessysLogChart.IsValueShownAsLabel = true;
seriessysLogChart.Points.DataBind(sysLogChart, "Key", "Count", "");
seriessysLogChart.ChartType = SeriesChartType.Column;
chart.Series.Add(seriessysLogChart);
var imageStream = new MemoryStream();
chart.SaveImage(imageStream, ChartImageFormat.Png);
imageStream.Position = 0;
return new FileStreamResult(imageStream, "image/png");
}
开发者ID:peisheng,项目名称:EASYFRAMEWORK,代码行数:55,代码来源:SysStatisticController.cs
示例13: ChartAddElementCommand
public ChartAddElementCommand(ChartArea area, IChartElement element)
{
if (area == null)
throw new ArgumentNullException("area");
if (element == null)
throw new ArgumentNullException("element");
Area = area;
Element = element;
}
开发者ID:reddream,项目名称:StockSharp,代码行数:11,代码来源:ChartAddElementCommand.cs
示例14: ChartRemoveElementCommand
public ChartRemoveElementCommand(ChartArea area, IChartElement element)
{
if (area == null)
throw new ArgumentNullException(nameof(area));
if (element == null)
throw new ArgumentNullException(nameof(element));
Area = area;
Element = element;
}
开发者ID:RakotVT,项目名称:StockSharp,代码行数:11,代码来源:ChartRemoveElementCommand.cs
示例15: CreateChartArea
protected override ChartArea CreateChartArea()
{
ChartArea chartArea = new ChartArea();
chartArea.AxisX.IsMarginVisible = false;
chartArea.AxisX.LabelStyle.Enabled = false;
chartArea.BorderDashStyle = ChartDashStyle.NotSet;
ConfigureAxis(chartArea.AxisX);
ConfigureAxis(chartArea.AxisY);
return chartArea;
}
开发者ID:benhejl,项目名称:SWENG500_Team1,代码行数:12,代码来源:OpenVsResolvedGraph.cs
示例16: ChartAddElementCommand
public ChartAddElementCommand(ChartArea area, IChartElement element, CandleSeries series = null)
{
if (area == null)
throw new ArgumentNullException(nameof(area));
if (element == null)
throw new ArgumentNullException(nameof(element));
Area = area;
Element = element;
Series = series;
}
开发者ID:RakotVT,项目名称:StockSharp,代码行数:12,代码来源:ChartAddElementCommand.cs
示例17: GenerateChartConrol
private Chart GenerateChartConrol()
{
var testChart = new Chart { ImageStorageMode = ImageStorageMode.UseImageLocation };
var tmpSeria = GenerateSeria();
var tmpChartArea = new ChartArea("");
testChart.ChartAreas.Add(tmpChartArea);
testChart.Legends.Add(new Legend(""));
testChart.Series.Add(tmpSeria);
testChart.Width = Parameters.ChartWidth;
testChart.Height = Parameters.ChartHeight;
return testChart;
}
开发者ID:nus-ii,项目名称:DotNetChartingOverview,代码行数:12,代码来源:MicrosoftChartAdapter.cs
示例18: CreateYAxis
/// <summary>
/// Creates Y axis for the specified series.
/// </summary>
/// <param name="chart">Chart control.</param>
/// <param name="area">Original chart area.</param>
/// <param name="series">Series.</param>
/// <param name="axisOffset">New Y axis offset in relative coordinates.</param>
/// <param name="labelsSize">Extar space for new Y axis labels in relative coordinates.</param>
public void CreateYAxis(Chart chart, ChartArea area, Series series, float axisOffset, float labelsSize)
{
// Create new chart area for original series
ChartArea areaSeries = chart.ChartAreas.Add("ChartArea_" + series.Name);
areaSeries.BackColor = Color.Transparent;
areaSeries.BorderColor = Color.Transparent;
areaSeries.Position.FromRectangleF(area.Position.ToRectangleF());
areaSeries.InnerPlotPosition.FromRectangleF(area.InnerPlotPosition.ToRectangleF());
areaSeries.AxisX.MajorGrid.Enabled = false;
areaSeries.AxisX.MajorTickMark.Enabled = false;
areaSeries.AxisX.LabelStyle.Enabled = false;
areaSeries.AxisY.MajorGrid.Enabled = false;
areaSeries.AxisY.MajorTickMark.Enabled = false;
areaSeries.AxisY.LabelStyle.Enabled = false;
areaSeries.AxisY.IsStartedFromZero = area.AxisY.IsStartedFromZero;
series.ChartArea = areaSeries.Name;
// Create new chart area for axis
ChartArea areaAxis = chart.ChartAreas.Add("AxisY_" + series.ChartArea);
areaAxis.BackColor = Color.Transparent;
areaAxis.BorderColor = Color.Transparent;
areaAxis.Position.FromRectangleF(chart.ChartAreas[series.ChartArea].Position.ToRectangleF());
areaAxis.InnerPlotPosition.FromRectangleF(chart.ChartAreas[series.ChartArea].InnerPlotPosition.ToRectangleF());
// Create a copy of specified series
Series seriesCopy = chart.Series.Add(series.Name + "_Copy");
seriesCopy.ChartType = series.ChartType;
foreach(DataPoint point in series.Points)
{
seriesCopy.Points.AddXY(point.XValue, point.YValues[0]);
}
// Hide copied series
seriesCopy.IsVisibleInLegend = false;
seriesCopy.Color = Color.Transparent;
seriesCopy.BorderColor = Color.Transparent;
seriesCopy.ChartArea = areaAxis.Name;
// Disable drid lines & tickmarks
areaAxis.AxisX.LineWidth = 0;
areaAxis.AxisX.MajorGrid.Enabled = false;
areaAxis.AxisX.MajorTickMark.Enabled = false;
areaAxis.AxisX.LabelStyle.Enabled = false;
areaAxis.AxisY.MajorGrid.Enabled = false;
areaAxis.AxisY.IsStartedFromZero = area.AxisY.IsStartedFromZero;
areaAxis.AxisY.LabelStyle.Font = area.AxisY.LabelStyle.Font;
// Adjust area position
areaAxis.Position.X -= axisOffset;
areaAxis.InnerPlotPosition.X += labelsSize;
}
开发者ID:samuellin124,项目名称:cms,代码行数:60,代码来源:MultipleYAxis.aspx.cs
示例19: AddNewChartArea
private void AddNewChartArea(int areaIndex)
{
if (areaIndex >= mChart.ChartAreas.Count)
{
ChartArea ca = new ChartArea("mChartArea" + mChart.ChartAreas.Count);
mChart.ChartAreas.Add(ca);
if (areaIndex >= mChart.ChartAreas.Count)
AddNewChartArea(areaIndex);
else
return;
}
}
开发者ID:nelsonjma,项目名称:ntec,代码行数:14,代码来源:chart.aspx.cs
示例20: OnStarted
protected override void OnStarted()
{
_series = new CandleSeries(typeof(TimeFrameCandle), Security, TimeFrame);
_shortSma.Length = ShortSmaPeriod;
_longSma.Length = LongSmaPeriod;
if (_area == null)
{
_area = new ChartArea();
_area.Elements.Add(new ChartCandleElement());
_area.Elements.Add(new ChartIndicatorElement { Color = Colors.Green, StrokeThickness = 1 });
_area.Elements.Add(new ChartIndicatorElement { Color = Colors.Red, StrokeThickness = 1 });
_area.Elements.Add(new ChartTradeElement());
new ChartAddAreaCommand(_area).Process(this);
}
this
.WhenNewMyTrades()
.Do(trades =>
{
foreach (var myTrade in trades)
{
new ChartDrawCommand(myTrade.Trade.Time, new Dictionary<IChartElement, object>
{
{ _area.Elements[3], myTrade }
}).Process(this);
}
})
.Apply(this);
_series
.WhenCandles()
.Do(Process)
.Apply(this);
this.GetCandleManager().Start(_series);
Security
.WhenMarketDepthChanged(SafeGetConnector())
.Do(md => new UpdateMarketDepthCommand(md).Process(this))
.Apply(this);
SafeGetConnector().RegisterMarketDepth(Security);
base.OnStarted();
}
开发者ID:reddream,项目名称:StockSharp,代码行数:49,代码来源:SmaStrategy.cs
注:本文中的ChartArea类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论