Israel

Israel

  • 698
  • 1.3k
  • 217.7k

My graph doesnt appear on my form...

May 20 2014 9:35 AM
Hi!

I cannot see appearing my graph on my form.
The first error message I receive is:

The type or namespace name 'UI' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

The segond is: 

The name 'SeriesChartType' does not exist in the current context



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.Data.SqlClient;
using System.Web.UI.DataVisualization.Charting;//The first Error message it's here


namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection("Data Source=localhost\\sqlexpress;Initial Catalog=master;Integrated Security=True");
            string qry = "select Name, salary from salary from employee";
            SqlDataAdapter da = new SqlDataAdapter(qry, conn);
            DataSet ds = new DataSet();
            da.Fill(ds,"salary");
            chart1.Series["Series1"].XValueMember="name";
            chart1.Series["Series2"].YValueMembers="salary";

            this.chart1.Titles.Add("employee salary");
            chart1.Series["series1"].ChartType = SeriesChartType.Pie;// the Segond error message it's here
            chart1.Series["series1"].IsValueShownAsLabel = true;

        }


    }
}


Answers (10)