2011-02-17 14 views
17

Sto usando i controlli del mapping MS asp.net. E sto usando il grafico radar per disegnare alcuni valori, ma per qualche motivo, le linee dell'asse X non si incontrano davvero nel mezzo.Disegno brutto del grafico radar MS asp.net

Ho impostato il LineWidth = 1, ma la linea richiede ancora 2 pixel e alcuni indicatori sono completamente spenti, o forse è la linea completamente spenta. Forse anche il mio testo è un po 'fuori, quindi per favore vedi la foto e spero che capirai il mio problema. =)

enter image description here

codice che genera il grafico: Coordinate

// 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

potete inserire il codice che genera il grafico e la definizione del grafico? –

+1

Spero che questo aiuti: [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

Prova questo: [1]: http://stackoverflow.com/questions/5013008/how-can-i-draw-a-radar-chart-using-microsoft-chart-control-for -net-framework-3% 5D% 5B1% 5D Spero che questo aiuti :) –

risposta

2

WPF si riferiscono al centro del pixel, non gli angoli, in modo da provare l'aggiunta di 0,5 a tutte le coordinate. Per mostrare questo è il caso considerare quanto segue 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> 

Qui si è reso normalmente e poi con un offset di 0,5 pixel applicata ad ogni coordinata:

Xaml lines

Problemi correlati