현재 차트가 포함 된 도구를 주요 구성 요소로 개발해야합니다. 차트 컨트롤도 나에게 새로운 것입니다. 나는 차트 컨트롤의 전체 그림을 배우고 이해하기 위해 많은 독서와 연구를 해왔다. 여기C# 각 누적 세로 막 대형 차트에 가로선 그리기
내가 너무 무엇을했는지 : 이미지가 아래 그림과 같이
모든 후, 나는 붙어 있었다 적층 열 차트에 수평 라인 (파란색 & 빨간색 수평선)을 그리는 방법에 대한 질문 지금까지 :
이 내 코드는 지금까지 있습니다 :
// X-Axis labels settings
chart.ChartAreas[0].AxisX.LabelStyle.Angle = -45;
chart.ChartAreas[0].AxisX.Interval = 1;
// Y-Axis labels settings
//chart.ChartAreas[0].AxisY.Minimum = 100;
chart.ChartAreas[0].AxisY.Minimum = 95;
// Plotting chart
using (YieldEntities context = new YieldEntities())
{
// Extract yield loss list
var yeilds = (
from yeild in context.YeildDatas
group yeild by new { yeild.Loss } into newyeild
select new
{
Loss = newyeild.Key.Loss,
Percentage = newyeild.Sum(p => p.Percentage)
}).OrderByDescending(p => p.Percentage);
//context.YeildDatas.Select(p => new { p.Loss, Percentage = p }).Distinct();
// Create new series
foreach (var yield in yeilds)
{
chart.Series.Add(yield.Loss);
chart.Series[yield.Loss].ChartType = SeriesChartType.StackedColumn100;
}
// Label settings for first series
chart.Series[0].SmartLabelStyle.Enabled = false;
chart.Series[0].LabelAngle = -90;
chart.Series[0].Font = new Font(Font.FontFamily, 15, FontStyle.Bold);
chart.Series[0].IsValueShownAsLabel = true;
var query = context.YeildDatas.ToList();
foreach (var item in query)
{
DataPoint dp = new DataPoint();
dp.SetValueXY(item.DateString, item.Percentage);
chart.Series[item.Loss].Points.Add(dp);
}
// Set empty datapoint for each series
foreach (var yield in yeilds)
{
DataPoint nulldp = new DataPoint();
nulldp.SetValueXY("", 0);
chart.Series[yield.Loss].Points.Insert(1, nulldp);
chart.Series[yield.Loss].Points.Insert(6, nulldp);
chart.Series[yield.Loss].Points.Insert(11, nulldp);
}
chart.Legends["Legend"].IsEquallySpacedItems = true;
chart.Legends["Legend"].IsTextAutoFit = true;
}
이 문제를 해결하기 위해 어떤 전문가라도 안내 할 수 있기를 바랍니다.
당신 스스로 당신의 차트 컨트롤을 그리는? 아니면 완성 된 차트 컨트롤을 사용하고 있습니까? finish 차트 컨트롤을 사용하는 경우 차트 컨트롤에서 이벤트 그림판을 사용하고 DrawLine을 시도하십시오 –
Visual Studio 2015에서 제공된 차트 컨트롤을 사용하고 있습니다. 선을 그리는 방법은 무엇입니까? –
귀하의 질문은 본질적으로 일련의 요구 사항입니다. 표시 할 코드는 무엇입니까? – MickyD