OpenFlashChart之拋物線地區圖

來源:互聯網
上載者:User

分頁檔

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Area.aspx.cs" Inherits="OFCDemo.ofc.Area" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <ofc:Chart ID="ofcArea" runat="server" Url="../data/AreaData.aspx" Width="90%"
            Height="500px" />
    </div>
    </form>
</body>
</html>

 資料檔案。

這裡是空心點拋物線和實心的拋物線都合并在一起開發的。

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OpenFlashChart;

namespace OFCDemo.data
{
    public partial class AreaData : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Graph graph = new Graph();
            graph.Title = new Title("拋物線地區圖", "{font-size: 14px;}");

            //X軸名,字型,字型顏色。
            graph.LegendX = new LegendX("拋物線圖", 12, "#000000");
            //Y軸名,字型,字型顏色。
            graph.LegendY = new LegendY("Text Value", 12, "#00FF00");
            //y軸的最大值
            graph.MaxY = 2;
            //y軸的最小值
            graph.MinY = -2;
            ////y軸的步長
            graph.StepsY = 2;
        
            //構造報表資料對象
            OpenFlashChart.Charts.ChartData areaLine, areaHollow;

            areaLine = new OpenFlashChart.Charts.Line(2, "#C4B86A", "實心點線圖", 12, 2);
           areaHollow = new OpenFlashChart.Charts.AreaHollow(2, 4, "#573567", 10, "空心點線圖", 12, "#573567");
            Random rd = new Random();
            for (float i = 0; i < 30; i++)
            {
                //加點值
                areaLine.Data.Add(Convert.ToSingle(Math.Sin(i * 0.2)));
                areaHollow.Data.Add(Convert.ToSingle(Math.Sin(i * 0.2) + 0.5));
                graph.LabelsX.Add(string.Format("{0}日", i));
            }
            graph.Data.Add(areaLine);
            graph.Data.Add(areaHollow);
            //輸出資料
            Response.Clear();
            Response.CacheControl = "no-cache";
            Response.Write(graph.ToString());
            Response.End();
        }
    }
}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.