コード例 #1
0
        private void GenerateStockStatusPieChart()
        {
            ReceiveDoc rec = new ReceiveDoc();

            progressBar1.Visible   = true;
            chartPie.UseWaitCursor = true;
            chartPie.Series.Clear();
            int storeId = (cboStores.SelectedValue != null) ? Convert.ToInt32(cboStores.SelectedValue) : 0;

            int neverRec = rec.CountNeverReceivedItems(storeId);

            curYear = Convert.ToInt32(cboYear.SelectedItem);
            curMont = (curYear == dtCurrent.Year) ? dtCurrent.Month : 12;
            progressBar1.PerformStep();



            DataTable dtList = new DataTable();

            dtList.Columns.Add("Type");
            dtList.Columns.Add("Value");
            dtList.Columns[1].DataType = typeof(Int64);

            //TODO: the pie has to display something doesn't it?

            Series ser = new Series("pie", ViewType.Pie3D);

            ser.DataSource = dtList;

            ser.ArgumentScaleType  = ScaleType.Qualitative;
            ser.ArgumentDataMember = "Type";
            ser.ValueScaleType     = ScaleType.Numerical;
            ser.ValueDataMembers.AddRange(new string[] { "Value" });
            ser.PointOptions.PointView = PointView.ArgumentAndValues;
            ser.LegendText             = "Key";
            ser.PointOptions.ValueNumericOptions.Format    = NumericFormat.Percent;
            ser.PointOptions.ValueNumericOptions.Precision = 0;

            progressBar1.PerformStep();

            ((PieSeriesLabel)ser.Label).Position          = PieSeriesLabelPosition.TwoColumns;
            ((PiePointOptions)ser.PointOptions).PointView = PointView.ArgumentAndValues;



            chartPie.Series.Add(ser);
            chartPie.Size = new System.Drawing.Size(1000, 500);
            progressBar1.PerformStep();


            lblHeader.Text         = GeneralInfo.Current.HospitalName + " Stock Status summary of year " + curYear + " of " + cboStores.Text;
            progressBar1.Visible   = false;
            chartPie.UseWaitCursor = false;
        }