게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
[C#]tchart series 생성 ..
게시물ID : programmer_15309짧은주소 복사하기
작성자 : 하린
추천 : 0
조회수 : 1691회
댓글수 : 11개
등록시간 : 2016/01/05 11:58:40
제목 없음.jpg
 
                   Graph_Name1 = "성";
                    for (int index = 0; index < F/M.Count; index++)
                    {
                        for (int index2 = 0; index2 < Name.Count; index2++)
                        {
                            expression = Graph_Name1 + "= '" + Name[index2] + "'";
                            var Graph = from dr in LowData_Graph.Select(expression).AsEnumerable().Distinct()
                                        group dr by new { Name1 = dr.Field<string>("F/M"), Name2 = dr.Field<string>("성") } into gg
                                        select new
                                        {
                                            LowName = gg.Key.Name1,
                                            Count = gg.Count();
                                        };
                            foreach (var x in Graph)
                            {
                                Name_List1.Add(x.LowName.ToString());
                                Sum_List.Add(x.Sum);
                            }
                        }
                        c.Header.Lines = new string[] { "집계" };
                        c.Series.Add(new Steema.TeeChart.Styles.HorizBar());
                        c.Series[index].Marks.Style = Steema.TeeChart.Styles.MarksStyles.Value;
                        c.Series[index].Clear();
                        c.Series[index].Add(Sum_List[index2],[Name_List1[index2]);

                    }
 
으로 할 경우 제가 원하는 그림과 같이 그래프가 뜨질 않습니다.
위의 굵게 표시 된 부분을  지우고

                        c.Series[0].Add(Sum_List[index2],[Name_List1[index2]);
                        c.Series[0].Add(Sum_List[index2],[Name_List1[index2]);
                        c.Series[1].Add(Sum_List[index2],[Name_List1[index2]);           
 
F/M의 For문 바깥에 위와 같이 해주면 원하는데로 뜨긴 합니다만...  for문으로 하나로 묶어서 출력을 해주고 싶은데 맨 위의 소스에 for문 안에 넣자니 막대그래프가 원하는대로 생성이 되질 않고...
             for (int index = 0; index < F/M.Count; index++)
            {
                  if(F/M[index] == "FeMale")
                  {
                        for (int index2 = 0; index < Name_List.Count; index++)
                        {
                              c.Series[index].Add(Sum_List[index]2,[Name_List1[index2]);
                        }
                  }
                  else 
                  {
                         for (int index2 = 0; index < Name_List.Count; index++)
                        {
                              c.Series[index].Add(Sum_List[index]2,[Name_List1[index2]);
                        }
                  } 
            }
이런식으로 바꾸자니 추후에 데이터 테이블의 필드와 값이 많아 질 경우 일일이 if문으로 지정을 할 수가 없더라구요...
위와 같은 방식으로 하는 방법밖에 없는지요...?
 
 
 
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호