당신이 SplineAreas
의 부드러운 모양을 좋아한다면 당신은 그 모습 얻기 위해 필요한 값을 계산할 수 있습니다
몇 가지 참고 사항 :
- I을 시리즈의 순서를 뒤집었다; 여러 가지 방법이 자신의
Y-Values
될 0
해야
- 정렬 평소와 같이, 및 빈
DataPoints
을 할 수있는 스택 DataPoints
필요성을 (대신 하나가 아마 역에 축적한다) ... 바로 색상을 얻을 수 있습니다.
- 물론 새로운 시리즈에서는 축적 된 값을 갖기 때문에 더 이상 실제 데이터 값에 액세스 할 수 없습니다. 적어도 계산을 뒤집지 않아도됩니다. 그래서 그들을 필요로한다면 그들을 어딘가에 둘 수 있습니다. 새로운
DataPoints' Tag
속성은 .. 는
- 당신은
LineTension
사용자 정의 특성을 설정하여 각 Series
의 '부드러움'을 하나의 옵션을 제어 할 수 있습니다 : 여기
chart2.Series[0].SetCustomProperty("LineTension", "0.15");
전체 예제 코드입니다 위의 스크린 샷을 작성하여
StackedArea chart1
의 데이터에서 '누적'
SplineArea chart2
을 계산합니다.
// preparation
for (int i = 0; i < 4; i++)
{
Series s = chart1.Series.Add("S" + i);
s.ChartType = SeriesChartType.StackedArea;
Series s2 = chart2.Series.Add("S" + i);
s2.ChartType = SeriesChartType.SplineArea;
}
for (int i = 0; i < 30; i++) // some test data
{
chart1.Series[0].Points.AddXY(i, Math.Abs(Math.Sin(i/8f)));
chart1.Series[1].Points.AddXY(i, Math.Abs(Math.Sin(i/4f)));
chart1.Series[2].Points.AddXY(i, Math.Abs(Math.Sin(i/1f)));
chart1.Series[3].Points.AddXY(i, Math.Abs(Math.Sin(i/0.5f)));
}
// the actual calculations:
int sCount = chart1.Series.Count;
for (int i = 0; i < chart1.Series[0].Points.Count ; i++)
{
double v = chart1.Series[0].Points[i].YValues[0];
chart2.Series[sCount - 1].Points.AddXY(i, v);
for (int j = 1; j < sCount; j++)
{
v += chart1.Series[j].Points[i].YValues[0];
chart2.Series[sCount - j - 1].Points.AddXY(i, v);
}
}
// optionally control the tension:
chart2.Series[0].SetCustomProperty("LineTension", "0.15");
출처
2016-08-10 17:01:23
TaW
'SplineArea' 차트 유형을 사용해보십시오. – jsanalytics
뾰족한 가장자리를 제거하려면 데이터 포인트와 소유자를 계산할 수 있습니다. 곡선과 선으로 구성된 채워진 패턴으로 영역을 그립니다. [여기] (http://stackoverflow.com/questions/38175238/stackedbar-borders-between-different-series/38261691?s=1|0.3676#38261691) 누적 좌표를 계산하는 예제입니다. – TaW
@jstreet, 불행히도 이 그래프는 누적 된 그래프가 아니지만 결과는 재미있어 보였습니다. 제안에 감사드립니다. – Adrian