• C# OWC11


    public void OcwChart(int[] Data,string[] DataName,string Yname,string Xname,string ChartName,string Dname)
    {
    try
    {
    //创建ChartSpace对象
    ChartSpaceClass mySpace = new ChartSpaceClass();
    //添加图表
    ChChart ChartMonth = mySpace.Charts.Add(0);
    //指定图表类型
    ChartMonth.Type = ChartChartTypeEnum.chChartTypeColumnClustered;
    // ChartMonth.Type = ChartChartTypeEnum.chChartTypeLineMarkers;
    ChartMonth.HasTitle = true;
    ChartMonth.HasLegend = true;
    ChartMonth.Title.Font.Bold = true;
    ChartMonth.Title.Font.Size = 12;
    ChartMonth.Title.Font.Color = "#ff3300";

    ChartMonth.Axes[0].HasTitle = true;
    //横轴名称
    ChartMonth.Axes[0].Title.Caption = Xname;

    ChartMonth.Axes[1].HasTitle = true;
    //纵轴名称
    ChartMonth.Axes[1].Title.Caption = Yname;

    ChartMonth.Axes[0].Title.Font.Bold = true;
    ChartMonth.Axes[0].Title.Font.Color = "#995540";
    ChartMonth.Axes[1].Title.Font.Bold = true;
    ChartMonth.Axes[1].Title.Font.Color = "#994400";




    //图表名称
    ChartMonth.Title.Caption = ChartName;

    ////生成横轴的名称
    //int data_i = 0;
    //for (int i = 0; i < 6; i++)
    //{
    // DataName[data_i] = string.Format("{0:" + string.Format("{0:D2}", i) + " 月 " + "}", (i + 1).ToString());
    // data_i++;
    //}
    string strValue = "";
    string strCateory = "";

    //将数据格式化
    for (int i = 0; i < DataName.Length; i++)
    {
    strCateory += DataName[i] + ' ';
    }

    for (int i = 0; i < Data.Length; i++)
    {
    strValue += Data[i].ToString() + ' ';
    }

    //添加序列
    ChartMonth.SeriesCollection.Add(0);
    ChartMonth.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimSeriesNames, (int)ChartSpecialDataSourcesEnum.chDataLiteral, Dname);
    ChartMonth.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strCateory);
    ChartMonth.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strValue);

    //输出图表
    string strAbsolutePath = Application.StartupPath + @" ate.gif";
    // mySpace.ExportPicture(strAbsolutePath, "GIF", pictureBox1.Width, pictureBox1.Height);
    // pictureBox1.ImageLocation = strAbsolutePath;
    }
    catch (Exception ex)
    {
    MessageBox.Show("流量图显示错误:" + ex.Message);
    }

    }

  • 相关阅读:
    字典序问题 算法实现题1-2
    统计数字问题 算法实现1-1
    P问题 NP问题 NPC问题 NP-Hard问题 简述
    Python argparse库简单入门
    HDU 3506 区间DP 四边形不等式
    HDU 1530 最大团问题 模板
    树状数组入门+代码
    HDU 1520 Anniversary party 树状dp
    京东 广告部门一面 4.22
    字节跳动 ailab二面 4.16
  • 原文地址:https://www.cnblogs.com/cyh328863397/p/7470820.html
Copyright © 2020-2023  润新知