1

各曜日を異なる色 (月曜日の赤、火曜日の緑など) で表示したいのですが、グラフにデータを正しく表示するのに問題があります。
私は毎日シリーズを持っています。しかし、ChartType:columnを使用すると、グラフは毎日非常に見苦しく表示されます (ここの画像を参照してください: http://i49.tinypic.com/oszeqt.png )。
グラフのデータ:

01:12000
02:12500
03:13000
04:13500
05:14029
06:14509
07:15000
08:15500
09:16000
10:16500
11:17000
12:17125

コードのビット

                        DateTime dateValue = new DateTime(2012, 5, int.Parse(tempDay));

                    switch ((int)dateValue.DayOfWeek)
                    {
                        case 1:
                            chart1.Series["Monday"].Points.AddXY(int.Parse(tempDay), int.Parse(tempTime));
                            break;
                        case 2:
                            chart1.Series["Tuesday"].Points.AddXY(int.Parse(tempDay), int.Parse(tempTime));
                            break;
                        case 3:
                            chart1.Series["Wednesday"].Points.AddXY(int.Parse(tempDay), int.Parse(tempTime));
                            break;
                        case 4:
                            chart1.Series["Thursday"].Points.AddXY(int.Parse(tempDay), int.Parse(tempTime));
                            break;
                        case 5:
                            chart1.Series["Friday"].Points.AddXY(int.Parse(tempDay), int.Parse(tempTime));
                            break;
                        case 6:
                            chart1.Series["Saturday"].Points.AddXY(int.Parse(tempDay), int.Parse(tempTime));
                            break;
                        case 7:
                            chart1.Series["Sunday"].Points.AddXY(int.Parse(tempDay), int.Parse(tempTime));
                            break;
                    }

私の質問:各列を日の色で正しく表示するにはどうすればよいですか? (毎日別のシリーズは必要ありません。)

4

2 に答える 2

1

わかりました、私はついに解決策を見つけました!

chart1.Series[0]["DrawSideBySide"] = "false";

その後、太すぎる場合は列の幅を設定する必要があります

chart1.Series[0]["PointWidth"] = "0.1";

これは、カスタムプロパティのシリーズプロパティのデザインにもあります。

于 2012-08-01T10:14:58.960 に答える
0

色自体が心配なのかどうかは正確にはわかりません。もしそうなら、私は次のようなものを使用しました:

Dim ListOfColors As List(Of String) = Utilities.BuildCustomColorPalette(firstColor)

..

Public Shared Function BuildCustomColorPalette(colorIN As String) As List(Of String)
      Dim arrCol() As String = {"DarkOrange", "Green", "Blue", "Yellow", "Purple", "Red", "Aqua", "Fuchsia", "Lime", "DodgerBlue", "Gold"}
      Dim listOfColors As New List(Of String)
      listOfColors.Add(colorIN)
      For idx = 0 To arrCol.Length - 1
         If listOfColors.Contains(arrCol(idx)) Then
            'nada
         Else
            listOfColors.Add(arrCol(idx))
         End If
         If listOfColors.Count = 10 Then
            Return listOfColors
         End If
      Next
      Return listOfColors
   End Function

.. 次のように使用します。

Chart.Series(Idx).Color = Color.FromName(ListOfColors(Idx))
于 2012-06-12T10:10:02.853 に答える