版本:open-flash-chart-2-Lug-Wyrm-Charmer

前台页面  index.aspx

 

代码
<html>
<head>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF(
"open-flash-chart-SimplifiedChinese.swf""my_chart""550""300",
"9.0.0""expressInstall.swf",
{
"data-file":"data.aspx"}
);
</script>

</head>
<body>

<p>Hello World</p>
<div id="my_chart"></div>
</body>
</html>
data.aspx.cs
代码
using System;
using System.Collections.Generic;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using OpenFlashChart;

public partial class data : System.Web.UI.Page
{
    
protected void Page_Load(object sender, EventArgs e)
    {
        OpenFlashChart.OpenFlashChart chart 
= new OpenFlashChart.OpenFlashChart();
        List
<double> data1 = new List<double>();

        
for (double i = 0; i < 6.2; i += 0.2)
        {
            data1.Add(Math.Sin(i) 
* 1.9 + 7);
        
        }

        OpenFlashChart.LineHollow line1 
= new LineHollow();
        line1.Values 
= data1;
        line1.HaloSize 
= 1;
        line1.Width 
= 2;
        line1.DotSize 
= 5;

        chart.AddElement(line1);
        chart.Y_Legend 
= new Legend("Y轴坐标");
        chart.Title 
= new Title("中文测试");
        chart.Y_Axis.SetRange(
0155);

        chart.X_Axis.SetLabels(
new string[] { "中文测试" ,"第二"});
        
        chart.X_Axis.Steps 
= 2;
        chart.X_Axis.Labels.VisibleSteps 
= 2;

        chart.X_Axis.Labels.Rotate
= "45"// 旋转45度
        Response.Clear();
        Response.CacheControl 
= "no-cache";
        Response.Write(chart.ToPrettyString());
        Response.End();
    }
}

 

 

另外,就一个单单页面好像不能让中文旋转。

如下页面

dataextend.aspx

代码
 1 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="dataextend.aspx.cs" Inherits="dataextend" %>
 2 <%@ Register Assembly="OpenFlashChart" Namespace="OpenFlashChart" TagPrefix="cc1" %>
 3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 4 
 5 <html xmlns="http://www.w3.org/1999/xhtml" >
 6 <head runat="server">
 7     <title>无标题页</title>
 8 </head>
 9 <body>
10     <form id="form1" runat="server">
11     <cc1:OpenFlashChartControl ID="OpenFlashChartControl1" runat="server">
12             </cc1:OpenFlashChartControl>
13     </form>
14 </body>
15 </html>

 

dataextend.aspx.cs

 

代码
using System;
using System.Collections.Generic;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using OpenFlashChart;

public partial class dataextend : System.Web.UI.Page
{
    
protected void Page_Load(object sender, EventArgs e)
    {
        OpenFlashChart.OpenFlashChart chart 
= new OpenFlashChart.OpenFlashChart();
        List
<double> data1 = new List<double>();

        
for (double i = 0; i < 6.2; i += 0.2)
        {
            data1.Add(Math.Sin(i) 
* 1.9 + 7);
        
        }

        OpenFlashChart.LineHollow line1 
= new LineHollow();
        line1.Values 
= data1;
        line1.HaloSize 
= 1;
        line1.Width 
= 2;
        line1.DotSize 
= 5;
        chart.AddElement(line1);
        chart.Y_Legend 
= new Legend("Y轴坐标");
        chart.Title 
= new Title("中文测试");
        chart.Y_Axis.SetRange(
0155);

        chart.X_Axis.SetLabels(
new string[] { "中文测试" ,"第二"});
        
        chart.X_Axis.Steps 
= 2;
        chart.X_Axis.Labels.VisibleSteps 
= 2;

        chart.X_Axis.Labels.Rotate
= "45"//这里旋转了 但是无用
        OpenFlashChartControl1.Chart = chart;
     }
}

 

 

 

 

posted on 2009-12-04 22:34  默西塞德  阅读(1285)  评论(0编辑  收藏  举报