Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Questions = new DataTable();

            if (!IsPostBack)
            {
                chkLogin();
                if (loggedin)
                {
                    user.ExcecuteQuery("select * from UserTable where UserID='" + Session["usr"] + "'");
                }
                DBC load = new DBC();
                load.ExcecuteQuery("Select * from Questions");
                Questions = load.DT;

                DBC    chart  = new DBC();
                Random random = new Random();
                chart.ExcecuteQuery("select * from Chart t1 inner join Questions t2 on t1.Qid=t2.id");
                Chart1.Series[0].ChartType   = SeriesChartType.Bubble;
                Chart1.Series[0].MarkerStyle = MarkerStyle.Circle;
                Chart1.Series[1].ChartType   = SeriesChartType.Bubble;
                Chart1.Series[1].MarkerStyle = MarkerStyle.Circle;
                Chart1.Series[2].ChartType   = SeriesChartType.Bubble;
                Chart1.Series[2].MarkerStyle = MarkerStyle.Circle;
                Chart1.ChartAreas[0].AxisX.MinorGrid.Enabled     = false;
                Chart1.ChartAreas[0].AxisX.MajorTickMark.Enabled = false;
                Chart1.ChartAreas[0].AxisX.MinorTickMark.Enabled = false;
                Chart1.ChartAreas[0].AxisX.Interval = 0;

                Chart1.ChartAreas[0].AxisX.LabelStyle.ForeColor = Color.White;
                Chart1.ChartAreas[0].AxisY.LabelStyle.Enabled   = false;

                Chart1.ChartAreas[0].AxisY.MajorTickMark.Enabled = false;
                Chart1.ChartAreas[0].AxisY.MinorTickMark.Enabled = false;

                Chart1.ChartAreas[0].AxisX.LineWidth = 0;
                Chart1.ChartAreas[0].AxisY.LineWidth = 0;
                Chart1.DataSource              = chart.DT;
                Chart1.Series[0].XValueMember  = "nature";
                Chart1.Series[0].YValueMembers = "size";
                Chart1.Series[1].XValueMember  = "food";
                Chart1.Series[1].YValueMembers = "size";
                Chart1.Series[2].XValueMember  = "animal";
                Chart1.Series[2].YValueMembers = "size";
                Chart1.DataBind();
                int i = 0;
                foreach (DataPoint d in Chart1.Series[0].Points)
                {
                    d.ToolTip = chart.DT.Rows[i]["Question"].ToString();
                    i++;
                }
                int j = 0;
                foreach (DataPoint d in Chart1.Series[1].Points)
                {
                    d.ToolTip = chart.DT.Rows[j]["Question"].ToString();
                    j++;
                }
                int k = 0;
                foreach (DataPoint d in Chart1.Series[2].Points)
                {
                    d.ToolTip = chart.DT.Rows[k]["Question"].ToString();
                    k++;
                }
            }
            Posts = new DataTable();
        }