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) + "\r\n月\r\n" + "}", (i + 1).ToString());
// data_i++;
//}
string strValue = "";
string strCateory = "";

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

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

//添加序列
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 + @"\rate.gif";
// mySpace.ExportPicture(strAbsolutePath, "GIF", pictureBox1.Width, pictureBox1.Height);
// pictureBox1.ImageLocation = strAbsolutePath;
}
catch (Exception ex)
{
MessageBox.Show("流量图显示错误:" + ex.Message);
}

}

C# OWC11的更多相关文章

  1. AxMicrosoft.Office.Interop.Owc11.AxSpreadsheet控件在C#中的引用

    这几天要是用AxMicrosoft.Office.Interop.Owc11.AxSpreadsheet控件做查询,发现一系列问题,一点点记录下来吧,以备后查: 第一.相关属性:http://www. ...

  2. OWC11生成统计图案例

    (1)饼状图:----通过修改参数生成不同的走势图, string strCategory = "优良率" + '\t' + "合格率" + '\t' + &q ...

  3. C# Microsoft.Office.Interop.Owc11 导出excel文件

    C# Microsoft.Office.Interop.Owc11 导出excel文件 1.新建项SupremeWindowsForms窗体应用项目(项目平台设置称X86) 注意:因为大多数第三方写的 ...

  4. [转]SSAS没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG)) (Microsoft Visual Studio)的解决办法

    转自:http://www.cnblogs.com/xvqm00/archive/2011/07/15/2107338.html 打开SSAS 数据源视图浏览数据时,提示 没有注册类别 (异常来自 H ...

  5. SharePoint 2013 运行在IIS 应用32位错误

    问题描述: 今天有一个项目因为用了OWC11,没有64位的dll,因此IIS设置了“启用32位应用程序”为true. 如图: 详细操作见:http://www.cnblogs.com/cainiaog ...

  6. 【Excel】Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046}:

    [Excel]Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-0000000000 ...

  7. [转] C#操作EXCEL,生成图表的全面应用

    gailzhao 原文 关于C#操作EXCEL,生成图表的全面应用 近来我在开发一个运用C#生成EXCEL文档的程序,其中要根据数据生成相应的图表,该图表对颜色和格式都有严格的要求,在百度和谷歌中搜索 ...

  8. OWC控件的使用

    环境:SQL Server 2005  Analysis Services + OWC 1.1 +Win 7 准备: 1.在SQL Server 2005 Analysis Services建好ola ...

  9. Chart图形 [GDI+] OWCChart统计图的封装类 (转载)

    点击下载 OWCChart.zip 利用OWC11进行作统计图的封装类. /// <summary> /// 类说明:进行作统计图的封装类 /// 联系方式:361983679 /// 更 ...

随机推荐

  1. Eclipse Java EE IDE for Web Developers 4.5.1 安装hibername tools 插件

    方式一:在线安装(太慢) 方式二:离线安装,下载hibernate tools 插件到本地,然后在eclipse菜单栏点击 help: ①添加插件,选择下载后的插件,内容框中可选择hibernate ...

  2. 基于视频压缩的实时监控系统-sprint1基于epoll架构的采集端程序设计

    part1:产品功能 part2:epoll机制   select与epoll区别 1.select与epoll没有太大的区别.除了select有文件描述符限制(1024个),select每次调用都需 ...

  3. Mysql Column 'xxxxx' in field list is ambiguous"

    使用了关联查询,两张表有相同的字段,所以说取值含糊不清: 使用别名.列名解决: 如 a.description

  4. java流程控制语句if

    一 if语句 if语句是指如果满足某种条件,就进行某种处理. 格式: if (条件语句){ 执行语句; …… } 流程图: 例如: public class IfDemo01 { public sta ...

  5. Centos搭建go环境以及go入门

    引言 本文主要聚焦于 如何在centos上搭建go环境以及go入门, 包括搭建go环境,hello world运行, 创建包等操作,初步入门go语言. 安装环境 在管理员权限下, 也就是root用户 ...

  6. HTML基础-05

    字体 文本颜色:color:red;字体分类: 衬线字体serif --字体宽度各异,有衬线 --Times.Georgia.宋体 无衬线字体sans-serif --字体宽度各异,无衬线 --Hel ...

  7. shell bash配置

    bash主要可以分为两种方式启动(login,no-login) 两种方式所读取的配置文件不同,所以环境不同 login形式启动如下图所示: no-login形式启动: 从 ~/.bashrc开始.

  8. Debug很重要

    之前做一个小功能,就是用php发送邮件,项目中已经使用了wordpress的wp_mail,所以同事建议我继续用wp_mail函数. 然而遇到了一个奇怪的情况,邮件没有发出去,也没有任何报错日志. 照 ...

  9. android.content.res.Resources$NotFoundException: String resource ID #0xb

    原代码: protected void convert(BaseViewHolder helper, Student item) { helper.setText(R.id.item_tv_realm ...

  10. 真正从底层理解 Synchronized 实现原理

    实现synchronized的基础有两个:Java 对象头和 Monitor. 在虚拟机规范中定义了对象在内存中的布局,主要由以下 3 部分组成: 对象头 实例数据 对齐填充 而synchronize ...