在文本框中将Asp图表的值更改为值更改 [英] Changing the value of Asp chart as value change in a TextBox

查看:72
本文介绍了在文本框中将Asp图表的值更改为值更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的先生,
我有一个包含三个数据点的asp图表,我要在更改文本框中的值时更改图表值,我已经搜索过它,但是没有找到任何有用的材料,请当我是新手.谢谢您

Dear Sir,
I have a asp chart which have three datapoints What I want is to change the chart values as I change value in textbox,I have searched about it But not found any useful material Please guide me as I am beginner.Thank you

推荐答案

您将必须通过C#代码来完成.在更改数据点的地方进行回发.由于只是图像,因此必须重新生成图像.

因此,有一个文本框可以自动回传,然后更改系列数据点中的值,图像将重新生成.
You''ll have to do it through the C# code. Cause a postback where you change the data points. Since it is just an image, the image has to be regenerated.

So, have a textbox that autopostsback and then change the value in the datapoints on your series and the image will be regenerated.


我已经完成了此代码,并且效果很好.谢谢我是初学者,我只是想了解我不是开发人员,因此如果您发现我自己有任何问题,请指导我.
谢谢


私有void Form1_Load(对象发送者,EventArgs e)
{

bmpDrawingArea =新的位图(宽度,高度);
graphDrawingArea = Graphics.FromImage(bmpDrawingArea);
}

私有无效Form1_Paint(对象发送者,System.Windows.Forms.PaintEventArgs e)
{
e.Graphics.DrawImage(bmpDrawingArea,0,0);
}

私有void btnGenerate_Click(对象发送者,EventArgs e)
{
int monday = int.Parse(this.txtMonday.Text);
int tuesday = int.Parse(this.txtTuesday.Text);
int周三= int.Parse(this.txtWednesday.Text);
int thursday = int.Parse(this.txtThursday.Text);
int星期五= int.Parse(this.txtFriday.Text);
graphDrawingArea.Clear(this.BackColor);
graphDrawingArea.DrawRectangle(新Pen(Color.Red),this.txtMonday.Left + 5,280-星期一,40,星期一);
graphDrawingArea.DrawRectangle(新Pen(Color.Blue),this.txtTuesday.Left + 5,280-周二,40,周二);
graphDrawingArea.DrawRectangle(new Pen(Color.Yellow),this.txtWednesday.Left + 5,280-wednesday,40,wednesday);
graphDrawingArea.DrawRectangle(新Pen(颜色.绿色),this.txt星期四.左+ 5,280-星期四,40,星期四);
graphDrawingArea.DrawRectangle(new Pen(Color.Maroon),this.txtFriday.Left + 5,280-Friday,40,Friday);
graphDrawingArea.DrawRectangle(new Pen(Color.Black),10,280,Width,1);
Invalidate();
}

私有void txtChangeValue_TextChanged(对象发送者,EventArgs e)
{
txtMonday.Text =(((TextBox)sender).Text;
}

私有void txtMonday_TextChanged(对象发送者,EventArgs e)
{
txtChangeValue.Text =(((TextBox)sender).Text;
}
I have done it like this code and its working well.thank you I am beginner and I just ask for understanding I am not Developer so if there is anything you find wrong out of me them please guide me.
Thanks


private void Form1_Load(object sender, EventArgs e)
{

bmpDrawingArea = new Bitmap(Width, Height);
graphDrawingArea = Graphics.FromImage(bmpDrawingArea);
}

private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
e.Graphics.DrawImage(bmpDrawingArea, 0, 0);
}

private void btnGenerate_Click(object sender, EventArgs e)
{
int monday = int.Parse(this.txtMonday.Text);
int tuesday = int.Parse(this.txtTuesday.Text) ;
int wednesday = int.Parse(this.txtWednesday.Text);
int thursday = int.Parse(this.txtThursday.Text);
int friday = int.Parse(this.txtFriday.Text);
graphDrawingArea.Clear(this.BackColor);
graphDrawingArea.DrawRectangle(new Pen(Color.Red), this.txtMonday.Left + 5, 280 - monday, 40, monday);
graphDrawingArea.DrawRectangle(new Pen(Color.Blue), this.txtTuesday.Left + 5, 280 - tuesday, 40, tuesday);
graphDrawingArea.DrawRectangle(new Pen(Color.Yellow), this.txtWednesday.Left + 5, 280 - wednesday, 40, wednesday);
graphDrawingArea.DrawRectangle(new Pen(Color.Green), this.txtThursday.Left + 5, 280 - thursday, 40, thursday);
graphDrawingArea.DrawRectangle(new Pen(Color.Maroon), this.txtFriday.Left + 5, 280 - friday, 40, friday);
graphDrawingArea.DrawRectangle(new Pen(Color.Black), 10, 280, Width, 1);
Invalidate();
}

private void txtChangeValue_TextChanged(object sender, EventArgs e)
{
txtMonday.Text = ((TextBox)sender).Text;
}

private void txtMonday_TextChanged(object sender, EventArgs e)
{
txtChangeValue.Text = ((TextBox)sender).Text;
}


这篇关于在文本框中将Asp图表的值更改为值更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆