zoukankan      html  css  js  c++  java
  • 图表

    .Net Framework 4及以上有Chart控件,添加 Series是图表中的柱状体的集合,Legends是柱状体的标题批注,Titles是整个图表的标题

    修改Series批注

    数据源--添加新数据源

    添加数据类--项目名称右键添加--LINQ to SQL类--点击资源服务管理器--通过连接的SQL数据库中的表直接拖进DataClass中

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Windows.Forms.DataVisualization.Charting;
    
    namespace WindowsFormsApplication5
    {
        public partial class Form1 : Form
        {
            public DataClasses1DataContext Context;//数据类1的数据链接文本
            public Form1()
            {
                InitializeComponent();
                Context = new DataClasses1DataContext();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                List<car> list = Context.car.Take(5).ToList();
                chart1.DataSource = list;
                chart1.Series["Series1"].XValueMember = "name";
                chart1.Series["Series1"].YValueMembers = "oil";
                chart1.Series["Series2"].XValueMember = "name";
                chart1.Series["Series2"].YValueMembers = "pailiang";
                chart1.Series["Series1"].ChartType = SeriesChartType.FastLine;
            }
        }
    }

  • 相关阅读:
    区分服务器和客户端,玩家的控制权
    分割字符串
    switch语句的使用
    博客暂停使用
    [题解]洛谷P1041 传染病控制
    [题解]洛谷P2668 斗地主
    [题解]洛谷P4017 最大食物链计数
    [题解]洛谷P1983 车站分级
    [OI学习笔记]倍增LCA
    [OI学习笔记]st表
  • 原文地址:https://www.cnblogs.com/happinesshappy/p/4598758.html
Copyright © 2011-2022 走看看