在winforms中显示统计信息

bbmckpt7  于 2023-01-14  发布在  其他
关注(0)|答案(1)|浏览(150)

我有一个统计数据的工作查询。它被输出到datagridview。接下来,我想通过图形来安排统计数据的显示。但是图形没有显示。here is what it looks like
下面是我代码:

void FillChartAnimalsStat()
    {
        SqlConnection con = new SqlConnection(@"Data Source=Anesia;Initial Catalog=WEP_Clinic_Db;Integrated Security=True");
        DataTable dt = new DataTable();
        con.Open();
        SqlDataAdapter da = new SqlDataAdapter("select kind_definition, count(*) as amount" +
                "\r\nfrom Kinds_of_animals inner join Patients on Kinds_of_animals.kind_id = Patients.kind_id " +
                "\r\ninner join Visits on Patients.patient_id = Visits.patient_id group by Kinds_of_animals.kind_definition order by amount desc", con);
        da.Fill(dt);
        chart1.Series["Statistics"].XValueMember = "kind_definition";
        chart1.Series["Statistics"].YValueMembers = "amount";
        chart1.Titles.Add("Види тварин на прийомах за частотою їх розподілу");

    }

我做了视频教程,以完全相同的方式重复了一切,但没有结果。我错过了什么?

相关问题