2017-06-27 4 views
0
mit C#

Ich brauche Punkte Werte in Diagrammdiagramm angezeigt wird, wenn ich das Ergebnis versucht warwie Werte auf Diagramm Diagramm anzuzeigen

enter image description here

Aber ich will es wie

enter image description here

Mein Code ist

SqlCommand territorycommand = new SqlCommand("select Terriotry,TotalAcheivmentVol,Forecast from ForecastTotal where Year = '" + DateTime.Now.Year.ToString() + "' and Terriotry = '" + territory + "' and month = '"+Month+"'", conn); 
        try 
        { 
         conn.Open(); 
         mydatareader = territorycommand.ExecuteReader(); 
         while (mydatareader.Read()) 
         { 
          chart1.Series["TotalAchievment"].Points.AddXY(mydatareader.GetString(0), mydatareader.GetInt32(1)); 
          chart1.Series["Forecast"].Points.AddY(mydatareader.GetInt32(2)); 
          chart1.ChartAreas[0].AxisX.LabelStyle.Interval = 1; 
          chart1.ChartAreas[0].AxisX.Interval = 1; 

         } 
        } 
        catch (Exception ex) 
        { 
         MessageBox.Show(ex.Message); 
        } 
        conn.Close(); 

Ist das möglich?

+0

Haben Sie 'chart1.Series versucht [ "TotalAchievment"] = IsValueShownAsLabel true'.? – praty

+0

thx es funktioniert^_^.. put ur antwort plz –

Antwort

0

Sie können Serienwert in Etikett vorzeigen als:

chart1.Series["TotalAchievment"].IsValueShownAsLabel = true 
chart1.Series["Forecast"].IsValueShownAsLabel = true 
+0

ist das gleiche in Liniendiagramm? –

+0

yup! Es gibt auch so genannte Smart Labels. Überprüfen Sie diese: https://stackoverflow.com/questions/12670580/how-to-make-series-labels-to-show-without-overlapping-each-other-asp-net-4-0 – praty

Verwandte Themen