당신은 당신이 Chart.DataBindTable 방법 (MSDN)를 사용해야합니다 막대 차트에서 그룹 시리즈를 찾고 있다면.
DataTable table = new DataTable();
table.Columns.Add("Day", typeof(string));
table.Columns.Add("Email", typeof(int));
table.Columns.Add("Calls", typeof(int));
table.Columns.Add("Contacts", typeof(int));
table.Columns.Add("Tasks", typeof(int));
table.Columns.Add("Meetings", typeof(int));
table.Columns.Add("Proposals", typeof(int));
table.Rows.Add("Monday", 1, 3, 3, 4, 5, 5);
table.Rows.Add("Tuesday", 1,6,8,2,0,3);
table.Rows.Add("Wednesday", 7, 6,3,0,2,1);
table.Rows.Add("Thursday", 1,5,5,9,3,1);
table.Rows.Add("Friday", 4,7,3,5,2,3);
//convert datatable to a IEnumerable form
var IEtable = (table as System.ComponentModel.IListSource).GetList();
//Bind the datatable to the chart using the DataBindTable method
Chart1.DataBindTable(IEtable, "Day");
: 다음 테스트로 사용하는 몇 가지 더미 코드의
:
Chart1.DataBindTable(IEtable, "Day");
이 다음과 같이 보입니다 차트를 생성합니다 :
그냥 다음 코드를 추가합니다
ECCTMP에서 설명한대로 레이블을 표시 할 수도 있지만 범례를 추가하면 더 깨끗해질 수 있습니다.
데이터 테이블의 백엔드 구조에 대해 자세히 설명해 주시겠습니까? –