0

我有一个蜡烛图(股票图表 OHLC),它在一个图表中显示多个公司数据,对于一个图表,我可以绘制图表,但有多个公司数据,我无法绘制图表.

为.net 使用“aspose.cell”。将图表导出到 excel 中,因为可以将具有多家公司的图表绘制为单独的股票图表,但我想将其制成一个图表。

代码:

 if (sheetIndex == 0)
        {
            sheetIndex = a_workbook.Worksheets.Add();
        }
        ACell.Worksheet chart1 = a_workbook.Worksheets[sheetIndex];

        chart1.Name = "CandleStick_Chart";

        //Create chart of Type  StockOpenHighLowClose
        int chartIndex = chart1.Charts.Add(AChart.ChartType.StockOpenHighLowClose, csrowno, 1, csrowno + 50, 30);

        //Initialize Chart
        AChart.Chart chartsh = chart1.Charts[chartIndex];
        chartsh.NSeries.Add("Data!" + GetColumnName(valuePair.stcol) + "15:" + GetColumnName(valuePair.stcol + 3) + (valuePair.endrow), true);
        chartsh.NSeries.CategoryData = "Data!" + GetColumnName(valuePair.stcol - 1) + "15:" + GetColumnName(valuePair.stcol - 1) + (valuePair.endrow);//   "Data!A2:A4";
       
        chartsh.NSeries[0].Name = "Open"; chartsh.NSeries[1].Name = "High";
        chartsh.NSeries[2].Name = "Low"; chartsh.NSeries[3].Name = "Close";
        chartsh.NSeries[0].DownBars.Area.ForegroundColor = System.Drawing.Color.Green;
        chartsh.NSeries[0].UpBars.Area.ForegroundColor = System.Drawing.Color.Red;
        chartsh.Title.Text = valuePair.chartname;
        chartsh.Title.TextFont.Color = System.Drawing.Color.Black;
        chartsh.Title.TextFont.IsBold = true;
        chartsh.Title.TextFont.Size = 12;

下面显示了我要绘制的图表 - 它的蜡烛棒 ohlc - 股票图表。 在此处输入图像描述

4

0 回答 0