Click here to Skip to main content
15,914,013 members
Home / Discussions / C#
   

C#

 
AnswerRe: Write an xml node in a specific position Pin
Heath Stewart15-Dec-05 21:49
protectorHeath Stewart15-Dec-05 21:49 
GeneralRe: Write an xml node in a specific position Pin
hellamasta15-Dec-05 22:17
hellamasta15-Dec-05 22:17 
GeneralRe: Write an xml node in a specific position Pin
Heath Stewart16-Dec-05 5:49
protectorHeath Stewart16-Dec-05 5:49 
GeneralRe: Write an xml node in a specific position Pin
hellamasta16-Dec-05 0:03
hellamasta16-Dec-05 0:03 
GeneralRe: Write an xml node in a specific position Pin
hellamasta16-Dec-05 0:05
hellamasta16-Dec-05 0:05 
GeneralRe: Write an xml node in a specific position Pin
Heath Stewart16-Dec-05 5:49
protectorHeath Stewart16-Dec-05 5:49 
QuestionHow to broad cast the voice files that are in the buffer. Pin
kumar_wha15-Dec-05 20:25
kumar_wha15-Dec-05 20:25 
QuestionZedGraph and dynamic data Pin
Genbox15-Dec-05 20:21
Genbox15-Dec-05 20:21 
Hi. I tried asking this question in ZedGraph article, but I got no answer.

I have a database with some data that I would like to be represented in graphs.
The database is like this:

exercise | weight | maxweight
squat | 100 | 120
deadlift | 120 | 130
rows | 50 | 20

<- edit: the spaces may not show correctly ->

I would like to represent the values from each exercise in graphs. but i have no idea how to do that. - i'm using the "bar-graph" from ZedGraph.
I would also like the graph to be dynamic, so that if a user inserts a new exercise, then the graph will extend with another graph.

this is what i have currently:
private void OnRenderGraph(System.Drawing.Graphics g, ZedGraph.MasterPane mPane)
{
GraphPane pane = mPane[0];
pane.Title = "Training";
pane.YAxis.Title = "Exercise";
pane.XAxis.Title = "Weight (kg)";

SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
SqlDataReader rdr = null;
conn.Open();
SqlCommand cmd = new SqlCommand("SELECT exercise FROM training WHERE userid='"+ Page.Request.Params["userid"] +"'", conn);
rdr = cmd.ExecuteReader();
rdr.Read();

double[] x = { 50, 30, 50 };
BarItem myCurve = pane.AddBar("Weight", x, null, Color.DarkGreen);
myCurve.Bar.Fill = new Fill(Color.DarkGreen, Color.LightGreen, Color.DarkGreen, 90f);
string[] labels = { rdr["exercise"].ToString() };
pane.YAxis.TextLabels = labels;

rdr.Close();
conn.Close();

// Draw the Y tics between the labels instead of at the labels
pane.YAxis.IsTicsBetweenLabels = true;

// Set the YAxis to Text type
pane.YAxis.Type = AxisType.Text;

// Set the bar type to stack, which stacks the bars by automatically accumulating the values
pane.BarType = BarType.Stack;

// Make the bars horizontal by setting the BarBase to "Y"
pane.BarBase = BarBase.Y;

pane.AxisChange(g);
}

I am very new to C# and asp.net.

I know that i should put the rdr.Close() and conn.Close() into an exception with the rest of the sql connection, but i'm still testing.
QuestionTask Scheduling in c#.net Pin
Malayil alex15-Dec-05 20:21
Malayil alex15-Dec-05 20:21 
AnswerWrong site Pin
Vikram A Punathambekar15-Dec-05 20:44
Vikram A Punathambekar15-Dec-05 20:44 
AnswerRe: Task Scheduling in c#.net Pin
Johny Ng16-Dec-05 10:54
Johny Ng16-Dec-05 10:54 
QuestionThreading Pin
Stephen McAllister15-Dec-05 20:08
Stephen McAllister15-Dec-05 20:08 
AnswerRe: Threading Pin
S. Senthil Kumar15-Dec-05 20:37
S. Senthil Kumar15-Dec-05 20:37 
GeneralRe: Threading Pin
Stephen McAllister15-Dec-05 22:24
Stephen McAllister15-Dec-05 22:24 
QuestionInteracting with Dallas IButton form C# Pin
Krrish15-Dec-05 19:49
Krrish15-Dec-05 19:49 
AnswerRe: Interacting with Dallas IButton form C# Pin
Heath Stewart15-Dec-05 21:21
protectorHeath Stewart15-Dec-05 21:21 
Questionwhy doesnt this xml load into an xmldoc ? Pin
g00fyman15-Dec-05 19:36
g00fyman15-Dec-05 19:36 
AnswerRe: why doesnt this xml load into an xmldoc ? Pin
S. Senthil Kumar15-Dec-05 20:41
S. Senthil Kumar15-Dec-05 20:41 
GeneralRe: why doesnt this xml load into an xmldoc ? Pin
g00fyman16-Dec-05 15:20
g00fyman16-Dec-05 15:20 
Questionnewbie in c# Pin
yaminilathatv15-Dec-05 19:36
yaminilathatv15-Dec-05 19:36 
AnswerRe: newbie in c# Pin
Vikram A Punathambekar15-Dec-05 21:49
Vikram A Punathambekar15-Dec-05 21:49 
GeneralRe: newbie in c# Pin
yaminilathatv15-Dec-05 22:23
yaminilathatv15-Dec-05 22:23 
AnswerRe: newbie in c# Pin
J4amieC15-Dec-05 21:49
J4amieC15-Dec-05 21:49 
GeneralRe: newbie in c# Pin
J4amieC15-Dec-05 21:51
J4amieC15-Dec-05 21:51 
GeneralRe: newbie in c# Pin
yaminilathatv15-Dec-05 22:27
yaminilathatv15-Dec-05 22:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.