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.