2011-02-17 5 views
17

나는 MS asp.net 차트 컨트롤을 사용하고 있습니다. 그리고 레이더 차트를 사용하여 값을 그리지 만, 어떤 이유로 X 축의 선이 실제로는 맞지 않습니다.미운 드로잉 MS asp.net 레이더 차트

나는 LineWidth = 1을 설정했으나 2 픽셀 정도의 선이 계속 사용되고 마커 중 일부는 완전히 꺼져 있거나 완전히 벗어난 선일 수 있습니다. 어쩌면 내 텍스트도 약간 떨어져 있기 때문에 그림을보고 잘하면 내 문제를 이해할 수있을 것입니다. 차트를 생성 =)

enter image description here

코드 :

// Populate series data 
Chart chart1 = new Chart(); 
chart1.ChartAreas.Add(new ChartArea("ChartArea1")); 

chart1.Height = new Unit(380); 
chart1.Width = new Unit(880); 
//chart1.AntiAliasing = AntiAliasingStyles.Graphics; 
//chart1.BackColor = Color.Transparent; 
chart1.Customize += new EventHandler(Chart_Customize); 

// Show as 3D 
chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = false; 
chart1.ChartAreas["ChartArea1"].AxisY.IntervalAutoMode 
    = IntervalAutoMode.FixedCount; 
chart1.ChartAreas["ChartArea1"].AxisY.Interval = 10; 
chart1.ChartAreas["ChartArea1"].AxisY.Maximum = 100; 

chart1.ChartAreas["ChartArea1"].AxisY.IsReversed = true; 

chart1.ChartAreas[0].AxisY.LineWidth = 1; 
chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.Gray; 
chart1.ChartAreas[0].AxisY.LineColor = Color.Gray; 
chart1.ChartAreas[0].AxisY.MajorTickMark.Enabled = false; 

List<string> names = new List<string>(); 
int namecounter = 1; 
foreach (var p in Model.Participants) 
{ 
    if (SessionHandle.ShowNamesInDiagrams) 
    names.Add(p.Person.Name); 
    else 
    names.Add(namecounter.ToString()); 
    namecounter++; 
} 

#region firstresult 
if (SessionHandle.ShowFirstResult) 
{ 
    chart1.Series.Add(new Series("FirstResult")); 
    List<double> firstresult = new List<double>(); 
    foreach (var p in Model.Participants) 
    { 
    var resultSummary = from r in Model.ResultSummary 
         where r.userID == p.ParentID && Model 
          .Modules 
          .Where(x => x.hasResult) 
          .ToList() 
          .Exists(x => x.ID == r.moduleID) 
         select r; 
    firstresult.Add(resultSummary.Sum(x => x.scorePercent) 
        /Model.Modules.Where(x => x.hasResult).Count()); 
    } 

    chart1.Series["FirstResult"].Points.DataBindXY(names, firstresult); 
    // Set radar chart type 
    chart1.Series["FirstResult"].ChartType = SeriesChartType.Radar; 

    // Set radar chart style (Area, Line or Marker) 
    chart1.Series["FirstResult"]["RadarDrawingStyle"] = "Marker"; 
    chart1.Series["FirstResult"].Color = Color.DarkBlue; 
    chart1.Series["FirstResult"].MarkerImage 
     = Url.Content("~/Content/Images/firstresult.png"); 

    // Set circular area drawing style (Circle or Polygon) 
    chart1.Series["FirstResult"]["AreaDrawingStyle"] = "Circle"; 

    // Set labels style (Auto, Horizontal, Circular or Radial) 
    chart1.Series["FirstResult"]["CircularLabelsStyle"] = "Horizontal"; 
} 
#endregion 
+2

당신이 생성하는 코드를 게시 할 수 차트 및 차트 정의 –

+1

이 도움이되기를 바랍니다. [http://stackoverflow.com/questions/5013008/how-can-i-draw-a-radar-chart-using-microsoft-chart-control-for-net-framework -3] [1] [1] : http://stackoverflow.com/questions/5013008/how-can-i-draw-a-radar-chart-using-microsoft-chart-control- for-net-framework-3 – c0D3l0g1c

+0

시험해보기 : [1] : http://stackoverflow.com/questions/5013008/how-can-i-draw-a-radar-chart-using-microsoft-chart-control-for -net-framework-3 % 5D % 5B1 % 5D 희망이 있습니다. –

답변

2

WPF는 픽셀이 아닌 모서리의 중심을 참조하여 모든 좌표에 0.5를 추가하려고 조정합니다. 이 경우 다음과 같은 XAML 생각입니다 표시하려면

<Canvas> 
<Line X1="50" Y1="50" X2="100" Y2="50" Stroke="Black" StrokeThickness="1" /> 
<Line X1="50" Y1="50" X2="50" Y2="100" Stroke="Black" StrokeThickness="1" /> 
<Line X1="50" Y1="50" X2="100" Y2="100" Stroke="Black" StrokeThickness="1" /> 
</Canvas> 
다음

가 적용 오프셋 0.5 픽셀과 일반적으로 다음 렌더링을 각각의 좌표

Xaml lines