熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

使用ZedGraph記錄

2022-06-13   來源: .NET編程 

  在網上找了半天終於確定一個工具……ZedGraph
    先在添加引用選擇ZedGraphdll
    然後在工具箱中添加ZedGraph控件
    將控件拖到頁面上
    然後在控件的RenderGraph事件中插入代碼
餅圖代碼
    Code
    GraphPane myPane =  (GraphPane)pane[];
    DataTable dt = ssihGetList(= order by 表A desc
    double tag = ;//看長
    double tag= ;//看中
    double tag= ;//看多
    int j=;
    foreach(DataRow dr in dtRows)
    {
    if(j==
    {
    tag = ConvertToDouble(dr[看長]ToString())*;
    tag = ConvertToDouble(dr[看中]ToString())*;
    tag = ConvertToDouble(dr[看多]ToString())*;
    }
    j++;
    }
    //標題粗體
    myPaneTitleFontSpecIsItalic = true;
    //背景
    myPaneFill = new Fill( ColorWhite ColorWhite f )
    myPaneChartFillType = FillTypeNone;
    //說明文字位置定義
    //            myPaneLegendPosition = LegendPosFloat;
    myPaneLegendLocation = new Location( f f CoordTypePaneFraction
    AlignHRight AlignVTop )
    myPaneLegendIsVisible = false;
    myPaneLegendFontSpecSize =f;
    myPaneLegendIsHStack = false;
    //            PieItem segment = myPaneAddPieSlice( tag ColorRed ColorWhite f 看多 +tagToString(##)+%
    //            PieItem segment = myPaneAddPieSlice( tag ColorWhite ColorWhite f 看平 +tagToString(##)+%
    //            PieItem segment = myPaneAddPieSlice( tag ColorBlue ColorWhite f  看空 +tagToString(##)+%
    折線圖及股票上證指數的K線圖
    Code
    //上證指數k線圖
    DataTable dt = ssihGetList(= order by dataDate asc
    double[] x = new double[dtRowsCount +];
    double[] y = new double[dtRowsCount +];
    double[] y = new double[dtRowsCount +];
    PointPairList pp = new PointPairList()
    int minCount = ConvertToInt( dtRowsCount
    for(int m=;m<minCount;m++)
    {
    dtRowsRemove(dtRows[])
    }
    int i = ;
    foreach(DataRow dr in dtRows)
    {
    y[i] = ConvertToDouble(dr[dxyc]ToString())*;
    x[i] =new XDate(ConvertToDateTime(dr[dataDate]))
    ppAdd(x[i]y[i])
    i++;
    }
    GraphPane myPane = (GraphPane)pane[];
    myPaneXAxisType = AxisTypeDate;
    myPaneXAxisScaleFormat = MMdd;
    myPaneLegendFontSpecSize =f;
    myPaneXAxisType = AxisTypeDateAsOrdinal;
    myPaneLegendPosition = LegendPosInsideTopRight;
    myPaneLegendLocation = new Location( f f CoordTypePaneFraction
    AlignHRight AlignVTop )
    LineItem myCurve = myPaneAddCurve(看多pp ColorRed SymbolTypeDiamond)
    myPaneAxisChange()
    Code
    DataTable dt = ssihGetList(= order by dataDate asc
    double[] x = new double[dtRowsCount +];
    double[] y = new double[dtRowsCount +];
    double[] y = new double[dtRowsCount +];
    double[] y = new double[dtRowsCount +];
    double[] y = new double[dtRowsCount +];
    double[] y = new double[dtRowsCount +];
    double[] y = new double[dtRowsCount +];
    XDate[] x = new XDate[dtRowsCount +];
    PointPairList pp = new PointPairList()
    PointPairList pp = new PointPairList()
    PointPairList pp = new PointPairList()
    PointPairList pp = new PointPairList()
    PointPairList pp = new PointPairList()
    PointPairList pp = new PointPairList()
    PointPairList pp = new PointPairList()
    int minCount = ConvertToInt( dtRowsCount
    for(int m=;m<minCount;m++)
    {
    dtRowsRemove(dtRows[])
    }
    int i = ;
    foreach(DataRow dr in dtRows)
    {
    y[i] = ConvertToDouble(dr[tag]ToString())*;
    y[i] = ConvertToDouble(dr[tag]ToString())*;
    y[i] = ConvertToDouble(dr[tag]ToString())*;
    y[i] = ConvertToDouble(dr[tag]ToString())*;
    y[i] = ConvertToDouble(dr[tag]ToString())*;
    y[i] = ConvertToDouble(dr[tag]ToString())*;
    x[i] =new XDate(ConvertToDateTime(dr[dataDate]))
    // ConvertToDouble( ConvertToDateTime(dr[dataDate])Month + + ConvertToDateTime(dr[dataDate])Day)  ;
    ppAdd(x[i]y[i])
    ppAdd(x[i]y[i])
    ppAdd(x[i]y[i])
    ppAdd(x[i]y[i])
    ppAdd(x[i]y[i])
    ppAdd(x[i]y[i])
    i++;
    }
    GraphPane myPane = (GraphPane)pane[];
    myPaneXAxisType = AxisTypeDate;
    myPaneXAxisScaleFormat = MMdd;
    myPaneXAxisType = AxisTypeDateAsOrdinal;
    myPaneLegendPosition =  LegendPosInsideTopRight;
    myPaneLegendLocation = new Location( f f CoordTypePaneFraction
    AlignHRight AlignVTop )
    myPaneLegendFontSpecSize =f;
    LineItem myCurve = myPaneAddCurve(熊市pp ColorGreen SymbolTypeDiamond)
    LineItem myCurve = myPaneAddCurve(熊市反彈pp  ColorDarkMagenta SymbolTypeDiamond)
    LineItem myCurve = myPaneAddCurve(熊轉牛pp  ColorDeepSkyBlue SymbolTypeDiamond)
    LineItem myCurve = myPaneAddCurve(牛調整pp  ColorThistle SymbolTypeDiamond)
    LineItem myCurve = myPaneAddCurve(牛加速pp  ColorRed SymbolTypeDiamond)
    LineItem myCurve = myPaneAddCurve(牛轉熊pp  ColorChartreuse SymbolTypeDiamond)


From:http://tw.wingwit.com/Article/program/net/201311/11649.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.