Girish
Girish

Reputation:

How to use chart control to show charts on web page?

I have a downloaded Microsoft chart control. I am not able to use it.

I have a web application in which there are number of online question & have 3 option Yes, No, Unsure. User can visit to the site, maybe go to solve the question.

I want to display the web chart that display the chart which shows number of Yes, No, Cancel as per question against any number vote.

Please give me reply how to use chart control for this. I am completely unaware with it.

Regards, Rishi

Upvotes: 0

Views: 1066

Answers (2)

Ganesh R.
Ganesh R.

Reputation: 4385

Kobis answer will be a good start. Also you can use Google charts API. Google charts will just need you to create a URL & it returns an image. But may be it may not be as configurable as Microsoft chart control.

Link: http://code.google.com/apis/chart/

Upvotes: 0

Kobi
Kobi

Reputation: 137997

Basically, you should add data to Chart1.Series[0].Points.

Have a look at the official site, it has samples, and you can download a project with many samples: http://code.msdn.microsoft.com/mschart/Release/ProjectReleases.aspx?ReleaseId=1591

Here's code from the official sample to create a pie chart (most of it is optional):

// Populate series data
double[]    yValues = {65.62, 75.54, 60.45, 34.73, 85.42};
string[]    xValues = {"France", "Canada", "Germany", "USA", "Italy"};
Chart1.Series["Default"].Points.DataBindXY(xValues, yValues);

// Set Doughnut chart type
Chart1.Series["Default"].ChartType = SeriesChartType.Doughnut;

// Set labels style
Chart1.Series["Default"]["PieLabelStyle"] = "Outside";

// Set Doughnut radius percentage
Chart1.Series["Default"]["DoughnutRadius"] = "30";

// Explode data point with label "Italy"
Chart1.Series["Default"].Points[4]["Exploded"] = "true";

// Enable 3D
Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enabled = true; 

// Disable the Legend
Chart1.Legends[0].Enabled = false;

Upvotes: 3

Related Questions