在网上找了半天终于确定一个工具……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) |