ASP.NET數據報表之柱狀圖 ------工作日志

#region 柱形色調
/// <summary>
/// 柱形色調
/// </summary>
private string[] myColor = new string[]
{
"DarkGreen",
"DimGray",
"DodgerBlue",
"Orchid", //Peru
"Orange",
"Orchid",
"Gold",
"Peru",
"Lime",
"Tan",
"Red",
"GreenYellow",
"DarkGreen",
"DimGray",
"Orchid"
};
#endregion

#region 創建webchart實例
/// <summary>
/// 創建webchart實例
/// </summary>
/// <param name="listValue"></param>
/// <param name="listText"></param>
private void bindchart(ArrayList listValue, ArrayList listText)
{
//遍歷DataTable為每條記錄生成一個柱狀
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;
}
//創建對象
ColumnChart mychart = new ColumnChart();

//設置柱子寬度
mychart.MaxColumnWidth = 44;
//顏色
mychart.Fill.Color = Color.FromName(this.myColor[i]);
//在柱子上顯示數量
mychart.DataLabels.Visible = true;
//數量的字體
mychart.DataLabels.Font = new Font("Verdana", 16);

//添加
float dsfgd = float.Parse(listValue[i].ToString());
mychart.Data.Add(new ChartPoint("", float.Parse(listValue[i].ToString())));
//備注
mychart.Legend = listText[i].ToString();

this.chartSp.Charts.Add(mychart);
this.chartSp.XTitle.Text = mychart.Legend;
}
//輔助設置
//背景色
//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}
//內部線條
chartSp.Border.Color = Color.FromArgb(200, 200, 200);
//邊框樣式
chartSp.BorderStyle = BorderStyle.None;
//y最大值
double max = double.Parse(listValue[maxValue].ToString());
int intv = 2;

//數量小于16的情況
if (max < 16)
{
max = 16;
}
//大于16的情況
else
{
intv = int.Parse(Math.Ceiling(max / 8).ToString());
max += intv;
}

//設置Y軸終點值
chartSp.YCustomEnd = int.Parse(max.ToString());
//y遞增值
chartSp.YValuesInterval = intv;

//生成
this.chartSp.RedrawChart();
}
#endregion

?


#region 綁定全部數據
public void ShowAllData()
{
if (Session["admin_Number"] == null)
{
Response.Write("<script language=javascript>alert('連接超時,請重新登錄!!');</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();//值
ArrayList listText = new ArrayList();//顯示文本
int yhl = sp.GetAllYHL();//用戶量
int sbl = sp.GetAllSBL();//設備量
int zsl = sp.GetAllSpShow();//展示量
int djl = sp.GetAllDJL();//點擊量
int azl = sp.GetAllAZL();//安裝量
int app = sp.GetAppCount(""); //應用數
int appUser = sp.GetAppUserCount("");//開發者人數
listValue.Add(yhl);
listValue.Add(sbl);
listValue.Add(zsl);
listValue.Add(djl);
listValue.Add(azl);
listText.Add("用戶量");
listText.Add("設備量");
listText.Add("展示量");
listText.Add("點擊量");
listText.Add("apk安裝量");
this.lblYHl.Text = yhl + "人";
this.lblSBL.Text = sbl + "部";
this.lblZSL.Text = zsl + "次";
this.lblDJL.Text = djl + "次";
this.lblAZL.Text = azl + "次";
this.lblAPP.Text = app + "個";
this.lblAppUser.Text = appUser + "人";
bindchart(listValue, listText);
}

}
#endregion

?

轉載于:https://www.cnblogs.com/DBtwoer/p/3987768.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/375602.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/375602.shtml
英文地址,請注明出處:http://en.pswp.cn/news/375602.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

接口安全--簽名驗證

為防止第三方冒充客戶端請求服務器&#xff0c;可以采用參數簽名驗證的方法&#xff1a; 將請求參數中的各個鍵值對按照key的字符串順序升序排列&#xff08;大小寫敏感&#xff09;&#xff0c;把key和value拼成一串之后最后加上密鑰&#xff0c;組成key1value1key2value2PRIV…

Runtime類

Runtime類也在java.lang包中&#xff0c;這個類沒有提供構造器&#xff0c;但是提供的卻非靜態方法&#xff0c;而是在方法中提供了一個靜態方法來返回當前進程的Runtime實例&#xff0c;采用的單例設計模式。 其作用&#xff1a;可以對當前java程序進程進行操作、打開本機程序…

Spring MVC 返回NULL時客戶端用$.getJSON的問題

如果Spring MVC返回是NULL&#xff0c;那么客戶端的$.getJSON就不會觸發&#xff1b; 20170419補充 后臺的輸出為&#xff1a; DEBUG [org.springframework.web.servlet.DispatcherServlet] - Null ModelAndView returned to DispatcherServlet with name springMVC: assuming …

duilib設置滾動條自動滾動到底

控件屬性中添加 vscrollbar"true" autovscroll"true"分別是啟用豎向滾動條&#xff0c;是否隨輸入豎向滾動

MVC,MVP 和 MVVM 的圖示

復雜的軟件必須有清晰合理的架構&#xff0c;否則無法開發和維護。 MVC&#xff08;Model-View-Controller&#xff09;是最常見的軟件架構之一&#xff0c;業界有著廣泛應用。它本身很容易理解&#xff0c;但是要講清楚&#xff0c;它與衍生的 MVP 和 MVVM 架構的區別就不容易…

Java JDBC學習實戰(二): 管理結果集

在我的上一篇博客《Java JDBC學習實戰&#xff08;一&#xff09;&#xff1a; JDBC的基本操作》中&#xff0c;簡要介紹了jdbc開發的基本流程&#xff0c;并詳細介紹了Statement和PreparedStatement的使用&#xff1a;利用這兩個API可以執行SQL語句&#xff0c;完成基本的CURD…

error: storage size of ‘threads’ isn’t known

出錯的代碼行&#xff1a; pthread_t threads[NUM_THREADS];原因&#xff1a; NUM_THREADS 無值 原先&#xff1a; #define NUM_THREADS修改為 #define NUM_THREADS 5

android之相機開發

http://blog.csdn.net/jason0539/article/details/10125017 android之相機開發 分類&#xff1a; android 基礎知識2013-08-20 22:32 9774人閱讀 評論(2) 收藏 舉報Android在android中應用相機功能&#xff0c;一般有兩種&#xff1a;一種是直接調用系統相機&#xff0c;一種自…

文件和文件夾權限-Win7公共盤中出現大量臨時文件

公司中有一個文件服務器&#xff0c;給不同部門和員工設置了不同的權限&#xff0c;最近有員工&#xff08;沒有修改權限&#xff0c;有讀取及執行,讀取,寫入&#xff09;反映在公共盤上修改文件的時候會產生大量的臨時文件&#xff0c;添加上修改權限之后就可以了&#xff0c;…

Duilib編輯框Edit輸入完自動跳到下一個編輯框

首先xml文件中設置edit的maxchar參數&#xff0c;默認255好像。 <edit maxchar"10" />然后在notify函數中加入以下代碼 if (msg.sType _T("textchanged")) {if (static_cast<CEditUI*>(msg.pSender)->GetMaxChar() msg.pSender->GetT…

Mysql數據庫安全管理配置

1.刪除test庫 原因&#xff1a; The default MySQL installation comes with a database named test that anyone can access. This database is intended only for tutorials, samples, testing, etc. Databases named "test" and also databases with names starti…

duilib清空richedit內容

推薦使用以下方法&#xff1a; m_pRichEdit->SetSelAll(); m_pRichEdit->Clear();不推薦使用以下方法&#xff1a; m_pRichEdit->SetText("");雖然效果是一樣的&#xff0c;但是當編輯框中文本存在多種格式的時候&#xff0c;第二種方法會存在問題&#x…

新學了一個用python編寫的簡單的百度貼吧帖子的爬蟲

# -*- coding: utf-8 -*- #--------------------------------------- # 作者&#xff1a;chendn # 語言&#xff1a;Python 2.7.10 #---------------------------------------import string,urllib2 def tieba(url,beginPage,endPage):for i in range(beginPage,endPage1):…

duilib自定義消息

/** NOTE: All Message Numbers below 0x0400 are RESERVED.** Private Window Messages Start Here:*/ #define WM_USER 0x0400從WM_USER往上加就行了

BZOJ 2190儀仗隊【歐拉函數】

問題的唯一難點就是如何表示隊長能看到的人數&#xff1f;如果建系&#xff0c;隊長所在的點為&#xff08;0,0&#xff09;分析幾組數據就一目了然了&#xff0c;如果隊長能看到的點為(m,n),那么gcd&#xff08;m&#xff0c;n&#xff09;1即m n 互質或者是&#xff08;0,1&a…

Codeforces Round #318 (Div. 2) B Bear and Three Musketeers (暴力)

算一下復雜度。發現可以直接暴。對于u枚舉a和b&#xff0c;判斷一下是否連邊&#xff0c;更新答案。 #include<bits/stdc.h> using namespace std;int n,m; const int maxn 4001; #define PB push_back vector<int> G[maxn]; bool g[maxn][maxn]; int deg[maxn]; …

form表單,submit,ajax提交

尼瑪... 一個簡單的表單提交&#xff0c;竟然給我整的直郁悶。 本來就是個保存功能&#xff0c;幾個前人都用的ajax提交&#xff0c;我也就沒改成submit。然后坑爹的就來了。 我在表單里寫了個<form></form>&#xff08;實際用ajax提交&#xff0c;也沒必要寫這個標…

windows 文件對話框

https://docs.microsoft.com/zh-cn/previous-versions/windows/desktop/legacy/bb776913(vvs.85)

python開發技術詳解(一)

python是一門簡單靈動的語言。從今天開始我要每天都做筆記&#xff0c;每天都要寫博客記錄我所想&#xff0c;我所學到的。 筆記提綱&#xff1a; 1&#xff0c;python的簡單介紹&#xff0c;python的編譯用法&#xff0c;有什么要注意的。 2&#xff0c;命名規則 3&#xff0c…