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. Idea debug报错Command line is too long

    问题: 使用idea开发Java项目,写单元测试,debug时,会有红字报错:Command line is too long 解决方法: 在项目的目录下,找到/.idea/workspace.xml ...

  2. 【java提高】(19)---BigDecimal详解和精度问题

    BigDecimal详解和精度问题 一.背景 在实际开发中,对于 不需要任何准确计算精度的属性可以直接使用float或double,但是如果需要精确计算结果,则必须使用BigDecimal,例如价格. ...

  3. H5移动端手势密码组件

    项目简介 最近参加了2017年360前端星计划,完成了一个有趣的UI组件开发大作业,借机和大家分享一下移动端开发的技术啦~~ 本项目采用原生JS和Canvas实现移动端手势密码组件,支持手势密码设置和 ...

  4. 利用 Python 写一个颜值测试小工具

    我们知道现在有一些利用照片来测试颜值的网站或软件,其实使用 Python 就可以实现这一功能,本文我们使用 Python 来写一个颜值测试小工具. 很多人学习python,不知道从何学起.很多人学习p ...

  5. 安装Scrapy的时候报错error: Microsoft Visual C++ 14.0 is required.

    error: Microsoft Visual C++ 14.0 is required. 问题:我在python安装Scrapy的时候发现报错,并安装不上. 解决思路:安装这个微软的库,但是这个库很 ...

  6. js 自定义属性操作

    自定义属性操作     element.属性 获取内置属性值     element.getAttribute("属性") 我们自己添加的属性叫自定义属性     element. ...

  7. tomcat启动失败的解决办法

    初次安装tomcat启动失败的解决办法: 1.CATALINA_HOME    C:\Program Files\apache-tomcat-8.5.242.path  %CATALINA_HOME% ...

  8. python中1 is True 的结果为False,is判断与==判断的区别

    python中1 is True 的结果为False,而1 == True的结果为True. python中True的数值就是1,那为什么1 is True 的结果为False呢? 因为is判断和== ...

  9. C++游戏(大型PC端枪战游戏)服务器架构

    实习期间深入参与到某大型pc端枪战游戏的后端开发中,此游戏由著名游戏工作室编写,代码可读性极高,自由时间对游戏后台代码进行了深入研究,在满足自身工作需要的同时对游戏后台的架构也有了理解,记录在此,以便 ...

  10. C#LeetCode刷题之#225-用队列实现栈(Implement Stack using Queues)

    问题 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/4106 访问. 使用队列实现栈的下列操作: push(x) -- ...