Development of glass Bar Chart Based on openflashchart

Source: Internet
Author: User

Page file.

<% @ Page Language = "C #" autoeventwireup = "true" codebehind = "grassbar. aspx. cs" inherits = "ofcdemo. OFC. grassbar" %>

<! 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 = "ofcgrassbar" runat = "server" url = "../data/grassbardata. aspx" width = "90%"
Height = "400px"/>
</Div>
</Form>
</Body>
</Html>

Data PageCode

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 grassbardata: system. Web. UI. Page
{
Protected void page_load (Object sender, eventargs E)
{
Graph graph = New Graph ();
// Define the title of the chart ..
Graph. Title = new title ("bar chart of glass column ",
"{Font-size: 20px; color: # 736aff; margin: 5px; padding: 5px; padding-left: 20px; padding-Right: 20px ;}");
Graph. Max y = 100;
Graph. miny =-50;
// Define the bar object (link transparency, bar color, project title, and project title Font size)
Openflashchart. charts. barglass bar =
New openflashchart. charts. barglass (75, "# d54c78", "#000000", "Project 1", 15 );

Openflashchart. charts. barglass bar2 =
New openflashchart. charts. barglass (75, "# 5500ff", "#000000", "Project 2", 15 );

// Assign a share
Random RD = new random ();
For (INT I = 1; I <13; I ++)
{
Bar. Data. Add (RD. Next (-50,100 ));
Bar2.data. Add (RD. Next (-50,100 ));
// X axis label
Graph. labelsx. Add (string. Format ("{0} month", I ));
}
// 3D X axis width.
Graph. axisx3d = 12;
// X, Y axis color.
Graph. axiscolorx = "#909090 ";
Graph. axiscolory = "#909090 ";
// Y axis label
Graph. legendy = new legendy ("Y axis data", 15, "# 736aff ");

Graph. Data. Add (bar );
Graph. Data. Add (bar2 );
// Output data
// Response. contentencoding = system. Text. encoding. default;
Response. Clear ();
Response. Write (graph. tostring ());
Response. End ();
}
}
}

The project and Y axis of the glass bar chart do not support Chinese characters.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.