ChartFX Y축 수치 제거 및 격자선 제거

이번에는 ChartFX Y축 수치 제거 하여 표시 부분을 나타나지 않도록 하고 격자선을 제거해 보도록 하겠습니다.

Y축에 숫자를 보이지 말고 격자모양의 점선을 없애달라는 요청을 받고 수정작업을 진행하였는데 생각보다 시간이 소요되었습니다. 속성을 주는 것이 어려운 것이 아니라 어떤 속성을 변경하여야 하는지 찾아보고 알아내는데 대부분의 시간이 소요 되었습니다. 소스를 보시면 간단합니다.

 SolidBackground solidBackground = new SolidBackground();
 solidBackground.Color = System.Drawing.Color.White;

 var chart = String.Empty;
 var swChart = new StringWriter();
 var hwChart = new HtmlTextWriter(swChart);

 var crtChart = new Chart
 {
 Width = 560,
 Height = 300,
 Gallery = Gallery.Lines,
 RenderFormat = "Image",
 Background = solidBackground,
 Border = new ChartFX.WebForms.Adornments.ImageBorder(ImageBorderType.Rounded)
 };

 crtChart.DataSourceSettings.Style = DataSourceStyles.Transpose;
 crtChart.Border.Color = Color.Transparent;

 crtChart.AxisY.Style |= AxisStyles.HideText;
 crtChart.AxisY.Style |= AxisStyles.Hide;

 crtChart.AxisX.Grids.Major.Visible = false;
 crtChart.AxisX.Grids.Minor.Visible = false;

 crtChart.DataSource = datasource;
 crtChart.DataBind();

 crtChart.RenderControl(hwChart);
 chart = swChart.ToString();

 litChart.Text = chart;

중간에 crtChart.AxisY.Style |= AxisStyles.HideText; 연산자(|=)에 유의 하셔야 합니다. = 로 대입하면 원하시는 형태로 출력되지 않습니다.

차트 출력 결과는 다음과 같습니다.

Y축 글자 제거 및 그리드 선 제거

ChartFX Y축 수치 제거 및 그리드 선 제거

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

Time limit is exhausted. Please reload the CAPTCHA.