Asp. NET Data Report Column chart------logbook

Source: Internet
Author: User

#region column Tones
<summary>
Column Tones
</summary>
Private string[] MyColor = new string[]
{
"Darkgreen",
"Dimgray",
"DodgerBlue",
"Orchid",//peru
"Orange",
"Orchid",
"Gold",
"Peru",
"Lime",
"Tan",
"Red",
"Greenyellow",
"Darkgreen",
"Dimgray",
"Orchid"
};
#endregion

#region Create WebChart instance
//<summary>
//Create WebChart instance
//</summary>
//<param name= "Li Stvalue "></PARAM>
//<param name=" Listtext "></PARAM>
private void Bindchart (ArrayList ListValue, ArrayList listtext)
{
//traverse DataTable to generate a histogram for each record
int maxValue = 0;
int max_ = 0;
for (int i = 0; i < Listvalue.count; i++)
{
if (Convert.ToInt32 (Listvalue[i]) > Max_)
{
Max_ = Convert.ToInt32 (Listvalue[i]);
MaxValue = i;
}
//Create object
Columnchart mychart = new Columnchart ();

//Set column width
mychart. Maxcolumnwidth = 44;
//Color
MyChart. Fill.color = Color.fromname (This.mycolor[i]);
//Show Quantity on column
MyChart. Datalabels.visible = true;
//Number of fonts
MyChart. Datalabels.font = new Font ("Verdana", 16);

//Add
Float DSFGD = float. Parse (Listvalue[i]. ToString ());
MyChart. Data.add (New Chartpoint ("", float. Parse (Listvalue[i]. ToString ()));
//Remarks
MyChart. Legend = Listtext[i]. ToString ();

THIS.CHARTSP.CHARTS.ADD (MyChart);
This.chartSp.XTitle.Text = MyChart. Legend;
}
Auxiliary settings
Background color
ChartControl1.Background.Color = Color.FromArgb (55, 0, 16);
ChartSp.YAxisFont.ForeColor = Color.FromArgb (165, 0, 16);//(165, 0, 16);
ChartSp.XAxisFont.ForeColor = Color.FromArgb (165, 0, 16);
Chartsp.yvaluesformat = "{0}"; {0:n}
Internal lines
ChartSp.Border.Color = Color.FromArgb (200, 200, 200);
Border Style
Chartsp.borderstyle = BorderStyle.None;
Y Maximum Value
Double max = double. Parse (Listvalue[maxvalue]. ToString ());
int INTV = 2;

Cases with a quantity less than 16
if (Max < 16)
{
max = 16;
}
Cases greater than 16
Else
{
INTV = Int. Parse (Math.ceiling (MAX/8). ToString ());
Max + = Intv;
}

Set the y-axis end value
chartsp.ycustomend = Int. Parse (max. ToString ());
Y increment value
Chartsp.yvaluesinterval = Intv;

Generated
This.chartSp.RedrawChart ();
}
#endregion


#region Bind all data
public void ShowAllData ()
{
if (session["admin_number"] = = null)
{
Response.Write ("<script language=javascript>alert (' connection timeout, please login again!! ');</script> ");
Response.Write ("<script language=javascript>parent.location.href= ' admin_login_.aspx ' </script>");
Response.Write ("<script language=javascript>window.open (' admin_login_.aspx '); Opener=null;top.close ();< /script> ");
}
Else
{
BLL_STATISTICSP sp = new BLL_STATISTICSP ();
ArrayList ListValue = new ArrayList ();//value
ArrayList listtext = new ArrayList ();//Display text
int YHL = sp. Getallyhl ();//user Volume
int SBL = sp. GETALLSBL ();//Device volume
int ZSL = sp. Getallspshow ();//Display volume
int DJL = sp. GETALLDJL ();//Click Volume
int AZL = sp. Getallazl ();//Installation Amount
int app = sp. Getappcount (""); Number of applications
int appuser = sp. Getappusercount ("");//Number of developers
Listvalue.add (YHL);
Listvalue.add (SBL);
Listvalue.add (ZSL);
Listvalue.add (DJL);
Listvalue.add (AZL);
Listtext.add ("User volume");
Listtext.add ("equipment volume");
Listtext.add ("Display volume");
Listtext.add ("Number of clicks");
Listtext.add ("APK installation Amount");
This.lblYHl.Text = Yhl + "person";
This.lblSBL.Text = SBL + "ministry";
This.lblZSL.Text = ZSL + "Times";
This.lblDJL.Text = Djl + "Times";
This.lblAZL.Text = Azl + "Times";
This.lblAPP.Text = app + "one";
This.lblAppUser.Text = appuser + "person";
Bindchart (ListValue, Listtext);
}

}
#endregion

Asp. NET Data Report Column chart------logbook

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.