开发代码基本和柱状图的一样,只是生成的类用FadeBar代替Bar而已。

 

页面

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

<!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 />
    </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 FadeBarData : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Graph graph = new Graph();
            //定义图表的标题。。
            graph.Title = new Title("褪色柱状图",
                "{font-size:20px; color: #736AFF; margin: 5px; padding:5px; padding-left: 20px; padding-right: 20px;}");
            graph.MaxY = 100;
            //定义柱状对象(链接透明度,bar条颜色,项目标题,项目标题字体大小)
            OpenFlashChart.Charts.BarFade bar =
                new OpenFlashChart.Charts.BarFade(75, "#D54C78", "页面浏览(万PV/月)", 15);

            OpenFlashChart.Charts.BarFade bar2 =
              new OpenFlashChart.Charts.BarFade(75, "#5500FF", "IP浏览(IP/月)", 15);

            //赋值份额
            Random rd = new Random();
            for (int i = 1; i < 13; i++)
            {
                bar.Data.Add(rd.Next(1, 100));
                bar2.Data.Add(rd.Next(1, 100));
                //X轴标签
                graph.LabelsX.Add(string.Format("{0}月", i));
            }
            //3d X轴宽度。
            graph.AxisX3D = 12;
            //x,y轴颜色。
            graph.AxisColorX = "#909090";
            graph.AxisColorY = "#909090";
            //Y轴标签
            graph.LegendY = new LegendY("PV(万)", 15, "#736AFF");

            graph.Data.Add(bar);
            graph.Data.Add(bar2);
            //输出数据
            //Response.ContentEncoding = System.Text.Encoding.Default;
            Response.Clear();
            Response.Write(graph.ToString());
            Response.End();
        }
    }
}

相关文章:

  • 2022-03-09
  • 2022-12-23
  • 2021-10-22
  • 2021-09-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
猜你喜欢
  • 2021-11-23
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2021-05-26
  • 2022-02-27
相关资源
相似解决方案