コード例 #1
0
        public void populate()
        {
            DataTable genderTable;
            //  genderTable = studentInfoDB.ReadDataGender();
            Chart genderChart = new Chart();

            DataSeries male = new DataSeries();

            male.RenderAs   = RenderAs.Column;
            male.LegendText = "Reservation";

            genderTable = reservationDB.ReadDataGender();

            foreach (DataRow genderRow in genderTable.Rows)
            {
                DataPoint aPoint = new DataPoint();
                // Set X & Y Value for a DataPoint
                aPoint.AxisXLabel = (genderRow.ItemArray[0]).ToString();
                aPoint.YValue     = Convert.ToDouble(genderRow.ItemArray[1]);
                // Add dataPoint to DataPoints collection
                male.DataPoints.Add(aPoint);
            }
            genderChart.Series.Add(male);

            genderChart.SmartLabelEnabled = true;
            ReservationsElementHost.Child = genderChart;
        }