tagCANDY CGI VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
[ツリー表示へ]  [ワード検索]  [Home]

タイトル MsChartで配列から折れ線グラフを書く
投稿日: 2004/10/28(Thu) 19:55
投稿者あき
[OSのVer]:Windows    [VBのVer]:VB.NET  
 [OSのVer]:Windows XP   [VBのVer]:VB.NET 2003
 はじめて投稿する初心者ですが、宜しくお願い致します。

 MsChartを使って、配列データから折れ線グラフを書こうとしています。
 グラフにするデータは元にあるアクセスデータベースから
 条件に合うものだけを抽出して、計算をしています。
 その計算結果は配列を持たせておいて、グラフ表示のボタンをクリックしたら
 表示するようにしたいと思っています。
 花ちゃんさんのサイトや他の掲示板も参考させて頂きやってみましたが・・・
  @指定していない系列(C1,C3,C5,C7)がグラフに表示される
  AX軸に表示させたいデータがY軸に表示され、X軸にはR(配列の番号)が表示される。
  以上の問題が解決できません。

 配列の部分はサンプルですが、プログラムを載せさせて頂きました。
 どなたか、ご指導のほど宜しくお願い致します。


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)    Handles Button1.Click
   Dim aa(10) As Double
   Dim bb(10) As Double
   Dim cc(10) As Double
   Dim VtChChartType2dLine As Integer
   Dim datacount As Integer

   Dim MyData(datacount, 6) As Double
   AxMSChart1.chartType = MSChart20Lib.VtChChartType.VtChChartType2dLine’チャートタイプ

   datacount=10

   For nn = 1 To datacount
        aa(nn)=100.55/nn
        bb(nn)=130.55/nn
        cc(nn)=150.55/nn
      MyData(nn, 1) = aa(nn)          'x値(データ1)
        MyData(nn, 2) = nn / 200         'y値(データ1)
        MyData(nn, 3) = bb(nn)           'x値(データ2)
        MyData(nn, 4) = nn / 200         'y値(データ2)
        MyData(nn, 5) = cc(nn)           'x値(データ3)
        MyData(nn, 6) = nn / 200         'y値(データ3)

With AxMSChart1
             .ChartData = MyData
             AxMSChart1.Plot.UniformAxis = True
             .chartType = 3 - VtChChartType2dLine
             .Plot.SeriesCollection(2).LegendText = "データ1"
             .Plot.SeriesCollection(4).LegendText = "データ2"
             .Plot.SeriesCollection(6).LegendText = "データ3"
           .Plot.SeriesCollection(2).SeriesMarker.Auto = False
.Plot.SeriesCollection(2).DataPoints(-1).Marker.Size =5
.Plot.SeriesCollection(2).DataPoints(-1).Marker.Style = VtMarkerStyleCircle
.Plot.SeriesCollection(2).DataPoints(-1).Marker.Visible = False
             .Plot.SeriesCollection(2).ShowLine = True
             .Plot.SeriesCollection(4).SeriesMarker.Auto = False
             .Plot.SeriesCollection(4).DataPoints(-1).Marker.Size = 5
             .Plot.SeriesCollection(4).DataPoints(-1).Marker.Style = VtMarkerStyleCircle
             .Plot.SeriesCollection(4).DataPoints(-1).Marker.Visible = False
             .Plot.SeriesCollection(4).ShowLine = True
             .Plot.SeriesCollection(6).SeriesMarker.Auto = False
             .Plot.SeriesCollection(6).DataPoints(-1).Marker.Size = 5
             .Plot.SeriesCollection(6).DataPoints(-1).Marker.Style = VtMarkerStyleCircle
             .Plot.SeriesCollection(6).DataPoints(-1).Marker.Visible = False
             .Plot.SeriesCollection(6).ShowLine = True
             .TitleText = "ハザード曲線"
             .ShowLegend = True
         End With

     Next nn
  End Sub

 ’プログラム自体はエラーなく、まわっています。
 ’よろしくお願い致します。 

- 関連一覧ツリー をクリックするとツリー全体を一括表示します)

古いスレッドにレスはつけられません。