Esempio n. 1
0
        private void AddNewSeries(UniversalEntity ue)
        {
            ChartSeries cs = new ChartSeries(radWP.SelectedText, ChartSeriesType.Spline);

            RadChart1.Series.Add(cs);
            int i = 0;
            List <ChartSeriesItem> csc = new List <ChartSeriesItem>();

            foreach (ArrayList al in ue)
            {
                ChartSeriesItem csi = new ChartSeriesItem();

                csi.YValue = (Convert.ToDouble(al[0]));
                csi.XValue = (i);
                //csi.XValue=(Convert.ToDateTime(al[1]).Ticks);

                //cs.AddItem((Convert.ToDouble(al[0]));
                i++;

                csc.Add(csi);
            }

            cs.AddItem(csc);

            RadChart1.DataBind();
            RadChart1.PlotArea.XAxis.LayoutMode = Telerik.Charting.Styles.ChartAxisLayoutMode.Normal;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.UsageChartDataBinding();

                LoadCompany();
            }

            List <UsageItem> us = new List <UsageItem>();

            DataView dv = (DataView)SqlDataSource4.Select(System.Web.UI.DataSourceSelectArguments.Empty);

            if (dv != null)
            {
                foreach (DataRowView dr in dv)
                {
                    UsageItem v = new UsageItem();


                    v.BillDt       = dr["BillDt"].ToString();
                    v.UsageSummary = (double)dr["UsageSummary"];

                    us.Add(v);
                }

                RadChart1.DataSource                      = us;
                RadChart1.Series[0].DataYColumn           = "UsageSummary";
                RadChart1.PlotArea.XAxis.DataLabelsColumn = "BillDt";

                RadChart1.DataBind();
            }
        }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Master.HeadingMessage = "Home";
     if (!IsPostBack)
     {
         RadChart1.DataSource = MMSqlDataSource;
         RadChart1.DataBind();
     }
 }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var dt = from k in _entities.GetBienDongNhanSu() orderby k.namsinh select k;
            List <GetBienDongNhanSu_Result> newLstBienDong = new List <GetBienDongNhanSu_Result>();
            List <GetBienDongNhanSu_Result> lstBienDong    = dt.ToList();
            int?SumNV = lstBienDong[0].soNV;

            for (int i = 1; i < lstBienDong.Count; i++)
            {
                SumNV += lstBienDong[i].soNV;
                lstBienDong[i].soNV = SumNV;
                newLstBienDong.Add(lstBienDong[i]);
            }
            RadChart1.Series[0].DataYColumn           = "soNV";
            RadChart1.PlotArea.XAxis.DataLabelsColumn = "namsinh";
            RadChart1.DataSource = newLstBienDong;
            RadChart1.DataBind();

            RadChart2.IntelligentLabelsEnabled = false;
            List <GetTyLeNamNu_Result> lstTyLe = _entities.GetTyLeNamNu().ToList();
            ChartSeries serie = new ChartSeries();

            serie.Name = "Giới tính";
            serie.Type = ChartSeriesType.Pie;
            serie.Clear();
            serie.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
            ChartSeriesItem item1 = new ChartSeriesItem();

            item1.YValue = (double)lstTyLe[0].Nam;
            //item1.Name = "Nam";
            item1.Appearance.Exploded  = true;
            item1.Label.TextBlock.Text = "Nam" + " - #%";
            serie.Items.Add(item1);

            ChartSeriesItem item2 = new ChartSeriesItem();

            item2.YValue = (double)lstTyLe[0].Nu;
            //item2.Name = "Nữ";
            item2.Appearance.Exploded  = true;
            item2.Label.TextBlock.Text = "Nữ" + " - #%";

            serie.Items.Add(item2);
            RadChart2.Series.Add(serie);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            // Populate the chart
            DataTable  tbl = new DataTable();
            DataColumn col = new DataColumn("Temp");
            col.DataType = typeof(int);
            tbl.Columns.Add(col);
            col          = new DataColumn("Measurement");
            col.DataType = typeof(string);
            tbl.Columns.Add(col);

            int    size   = 20;
            int    maxLen = size.ToString().Length;
            Random r      = new Random();
            for (int i = 1; i <= size; i++)
            {
                tbl.Rows.Add(new object[] { r.Next(40), "Measurement " + i.ToString("D" + maxLen) });
            }
            RadChart1.DataSource = tbl;
            RadChart1.DataBind();
        }
    }
        protected void btnApply_Click(object sender, EventArgs e)
        {
            if (cboCompany.SelectedItem.Value != string.Empty &&
                cboCycle.SelectedItem.Value != string.Empty &&
                !string.IsNullOrEmpty(txtAcctNum.Text) &&
                !string.IsNullOrWhiteSpace(txtAcctNum.Text))
            {
                //use viewUsageSummarybyAccount view
                List <UsageItem> us = new List <UsageItem>();

                DataView dv = (DataView)SqlDataSource3.Select(System.Web.UI.DataSourceSelectArguments.Empty);

                if (dv != null)
                {
                    foreach (DataRowView dr in dv)
                    {
                        UsageItem v = new UsageItem();


                        v.BillDt       = dr["BillDt"].ToString();
                        v.UsageSummary = (double)dr["UsageSummary"];

                        us.Add(v);
                    }

                    RadChart1.DataSource                      = us;
                    RadChart1.Series[0].DataYColumn           = "UsageSummary";
                    RadChart1.PlotArea.XAxis.DataLabelsColumn = "BillDt";

                    RadChart1.DataBind();
                }
            }
            else
            {
                if (cboCompany.SelectedItem.Value != string.Empty &&
                    cboCycle.SelectedItem.Value != string.Empty)
                {
                    //use viewUsageSummaryByCycle view
                    List <UsageItem> us = new List <UsageItem>();

                    DataView dv = (DataView)SqlDataSource2.Select(System.Web.UI.DataSourceSelectArguments.Empty);

                    if (dv != null)
                    {
                        foreach (DataRowView dr in dv)
                        {
                            UsageItem v = new UsageItem();


                            v.BillDt       = dr["BillDt"].ToString();
                            v.UsageSummary = (double)dr["UsageSummary"];

                            us.Add(v);
                        }

                        RadChart1.DataSource                      = us;
                        RadChart1.Series[0].DataYColumn           = "UsageSummary";
                        RadChart1.PlotArea.XAxis.DataLabelsColumn = "BillDt";

                        RadChart1.DataBind();
                    }
                }
                else
                {
                    if (cboCompany.SelectedItem.Value != string.Empty)
                    {
                        List <UsageItem> us = new List <UsageItem>();

                        DataView dv = (DataView)SqlDataSource1.Select(System.Web.UI.DataSourceSelectArguments.Empty);

                        if (dv != null)
                        {
                            foreach (DataRowView dr in dv)
                            {
                                UsageItem v = new UsageItem();


                                v.BillDt       = dr["BillDt"].ToString();
                                v.UsageSummary = (double)dr["UsageSummary"];

                                us.Add(v);
                            }

                            RadChart1.DataSource                      = us;
                            RadChart1.Series[0].DataYColumn           = "UsageSummary";
                            RadChart1.PlotArea.XAxis.DataLabelsColumn = "BillDt";

                            RadChart1.DataBind();
                        }
                    }
                    else
                    {
                        //use all data
                        List <UsageItem> us = new List <UsageItem>();

                        DataView dv = (DataView)SqlDataSource4.Select(System.Web.UI.DataSourceSelectArguments.Empty);

                        if (dv != null)
                        {
                            foreach (DataRowView dr in dv)
                            {
                                UsageItem v = new UsageItem();


                                v.BillDt       = dr["BillDt"].ToString();
                                v.UsageSummary = (double)dr["UsageSummary"];

                                us.Add(v);
                            }

                            RadChart1.DataSource                      = us;
                            RadChart1.Series[0].DataYColumn           = "UsageSummary";
                            RadChart1.PlotArea.XAxis.DataLabelsColumn = "BillDt";

                            RadChart1.DataBind();
                        }
                    }
                }
            }
        }
        protected void RadButtonEstimate_Click(object sender, EventArgs e)
        {
            String errorMessage = null;

            T = f = ff = 0;

            if (IsModelEstimated)
            {
                IsModelEstimated = false;
            }
            else
            {
                IsModelEstimated = false;
                Boolean ok = CheckInputs(out errorMessage);

                Double eta = 0, beta = 0;

                ok = TWeibullMarkovLibrary.Weibull.EstimateParameters(RadNumericTextBox1.Text, RadNumericTextBox2.Text, RadComboBox1.SelectedValue, out eta, out beta, out errorMessage);


                if (ok && beta <= 0.0)  // DIG 2/2/2012  This should never happen
                {
                    ok           = false;
                    errorMessage = String.Format(@"Weibull model cannot be created for the given input: the 50% survival period is too short in comparison to the {0} period. 
Your options are: increase the first period, decrease the second period, or go with the default slope parameter (choose ""Don't know"" for the second threshold).", RadComboBox1.Text.Trim());
                }

                if (ok)
                {
                    Eta  = eta;
                    Beta = beta;
                    ok   = Tabulate(out errorMessage);
                }

                if (ok)
                {
                    lblError.Text    = String.Empty;
                    lblError.Visible = false;
                    ModelTable.Rows[0].Cells[2].Text = String.Format(" = {0:g6}", Beta);
                    ModelTable.Rows[1].Cells[2].Text = String.Format(" = {0:g6}", Eta);
                    if (Beta < 1.0)
                    {
                        ModelTable.Rows[0].Cells[2].Text     += "*";
                        ModelTable.Rows[0].Cells[2].ForeColor = System.Drawing.Color.Red;
                        ModelTable.Rows[0].Cells[2].ToolTip   = @"The model has been estimated, but the slope parameter is less than one, which is typical for deterioration patterns known as ""infant mortality"", when deterioration tends to decrease over time rather than increase.  This is not an error, but please be aware that for the advanced age the policy may prescribe less aggressive treatment than for early years, which may look counter-intuitive.";
                        ModelTable.Rows[3].Cells[0].Text      = "* Please fly the cursor over the red number for details.";
                    }
                    else if (Beta == 1.0)
                    {
                        ModelTable.Rows[0].Cells[2].Text     += "*";
                        ModelTable.Rows[0].Cells[2].ForeColor = System.Drawing.Color.Red;
                        ModelTable.Rows[0].Cells[2].ToolTip   = @"When slope parameter (beta) equals 1 deterioration rate is constant over time.  The policy recommendations for the condition state in such case do not change from year to year.";
                        ModelTable.Rows[3].Cells[0].Text      = "* Please fly the cursor over the red number for details.";
                    }
                    else
                    {
                        ModelTable.Rows[0].Cells[2].ForeColor = System.Drawing.Color.Black;
                        ModelTable.Rows[0].Cells[2].ToolTip   = String.Empty;
                        ModelTable.Rows[3].Cells[0].Text      = String.Empty;
                    }
                    RadChart1.DataSource = null;
                    RadChart1.DataSource = _dt;
                    RadChart1.DataBind();
                    RadChart1.PlotArea.SeriesCollection().GetSeries(0).Appearance.LabelAppearance.Visible = false;
                    RadChart1.PlotArea.SeriesCollection().GetSeries(1).Appearance.LabelAppearance.Visible = false;
                    if (IsLastState)
                    {
                        RadChart1.ChartTitle.TextBlock.Text = "Probability of failure (percent)";
                    }
                }
                else
                {
                    lblError.Text    = errorMessage;
                    lblError.Visible = true;
                }
                IsModelEstimated = ok;
            }
            SetControlsAvailability();
        }