古鲁的请halp这个可怜的padawan。C#数据图表x轴显示多个城市windows窗体
我想显示一个图表,我给我的数据库中的值。在X轴上,我只想要一个叫做“鹿特丹”的城市,但它在其他行的X轴上给了我多次鹿特丹。
The chart where I am talking about
这是代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'official_DatabaseDataSet.fietsdiefstal' table. You can move, or remove it, as needed.
this.fietsdiefstalTableAdapter.Fill(this.official_DatabaseDataSet.fietsdiefstal);
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
chart1.Series["Fietsdiefstal"].XValueMember = "Plaats";
chart1.Series["Fietsdiefstal"].YValueMembers = "Begintijd";
chart1.DataSource = official_DatabaseDataSet.fietsdiefstal;
chart1.DataBind();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
fietsdiefstalBindingSource.EndEdit();
fietsdiefstalTableAdapter.Update(official_DatabaseDataSet.fietsdiefstal);
MessageBox.Show("Your data has been succesfully saved.", " Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void chart1_Click(object sender, EventArgs e)
{
}
private void fillByToolStripButton_Click(object sender, EventArgs e)
{
try
{
this.fietsdiefstalTableAdapter.FillBy(this.official_DatabaseDataSet.fietsdiefstal);
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
private void time1300ToolStripButton_Click(object sender, EventArgs e)
{
try
{
this.fietsdiefstalTableAdapter.Time1300(this.official_DatabaseDataSet.fietsdiefstal);
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
private void timeToolStripButton_Click(object sender, EventArgs e)
{
try
{
this.fietsdiefstalTableAdapter.Time(this.official_DatabaseDataSet.fietsdiefstal, param1ToolStripTextBox.Text);
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
private void param1ToolStripLabel_Click(object sender, EventArgs e)
{
}
private void straatToolStripButton_Click(object sender, EventArgs e)
{
try
{
this.fietsdiefstalTableAdapter.Straat(this.official_DatabaseDataSet.fietsdiefstal, param1ToolStripTextBox1.Text);
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
}
}
请花一些时间来阅读[提问]的文档(http://stackoverflow.com/help/asking)。您应该提供更多关于您的问题和[最小,完整和可验证示例]的详细信息(https://stackoverflow.com/help/mcve)。 – MrZander
现在好点了吗? –
很多!我会删除我的downvote :) – MrZander