Create a pie chart using values in a text file - c#

I'm making a questionnaire that shows results as charts I have decided to have the questionnaire write the results in an text f file when the user submits and want to read the file in and then assign the values to a pie chart I have all this done apart from the pie chart and am sort of struggling with it and help is greatly appreciated thank you.

The most "vanilla" solution is to draw a image and host it in a PictureBox. But drawing a Pie Chart Image by code is far from easy. It goes a bit to deeply into image drawing for the average programmer.
If you want a simple solution with a prexisting control element, you have to add some 3rd Party Libraries to your setup. The DevExpress and Infographics libraries both have PieChart controls:
https://www.infragistics.com/samples/windows-forms/chart/2d-pie-chart
https://documentation.devexpress.com/WindowsForms/2978/Controls-and-Libraries/Chart-Control/Fundamentals/Series-Views/2D-Series-Views/Pie-and-Donut-Series-Views/Pie-Chart
So you can pick your pioson.

Related

how to plot multiple y-axis in chart control

I am creating a web application using c#. I have four values(or series) volt,current,wh and temperature which I will have to plot in a chart control against time which(time) will be shown in x-axis. All things done correctly. But the range of the values are different like one is in range of more than 1000,another lies between 0 to 10,another shows negetive value,etc. I want to create different y-axis for each series.I had created two y-axis which is a property of series(YAxisType),primary and secondary. Is it possible to create multiple y-axis?I had searched in google but didn't get any proper answer. Please help me.
You can only use 2 y-axis(primary and secondary)
But you can create a few chart areas within one chart control
Or you can add a button that will hide one chart control and show another(with others 2 axis)

Bars in Bar graph are of different size

I am drawing a bar chart and I saw some of them have different width than others.
I tried changing PointWidth and PixelPointWidth properties. But of no use. Here is the graph I got :
The only configure I done is barChart1.Series["DeltaE"]["PointWidth"] = (0.6).ToString();
You may have too many data and the chart is too small. Try delete some data or make the chart bigger.
I made an example. I created a c# project, put a chart in the form, randomly add some data and run the program.
When the chart is big enough, it looks well.
When the chart is smaller, not all the columns are the same width.

Email a graph generated with ASP

I have an MVC4 application that I am working on and I am trying to find a way to generate a line graph that I can then send out in an email.
Clients are also going to be looking a graphs of similar data on a website and I would like to use the same tool for each (for visual consistency and maintenance).
I looked into using Microsoft Chart Controls, but I can't find any MVC4/Razor examples or tutorials.
Can anyone point me in the right direction?
All of the Microsoft chart controls have the ability to save the chart as a PNG file. You would need to save the chart and either embed it as part of an HTML-formatted message body or attach the image.
some sample code
This isn't much, but it should get you started.
var chart = new Chart
{
Height = 300,
Width = 500
};
chart.Legends.Add(new Legend());
chart.Series.Add(new Series());
chart.ChartAreas.Add(new ChartArea());
chart.Titles.Add(new Title());
chart.SaveImage(savePath);

With Infragistics,how can i mark a Specific point in SplineChart?

Now i have a DataGridView control bingding with some data from DB , and a SplineChart shows the data . i would like to hightlight or mark the Specific point in the Chart when i click the data in the DataGridView control.
what i use to draw the chart is Infragistics ultraChart(SplineChart),C# WinForm.
Can anyone help me with that?
You can use the charts ChartDrawItem method to customize the color of specific data points. There is an example of this in Sung's Chart University blog post in the Changing the Color of an Item Based on a Condition (2D only) section.

Stairstepping piecharts with asp:chart control

I was perusing the asp.net chart control's sample website, and came across something in the pie chart gallery. There was 3 pie charts, "stair stepped" on top of each other. I starting using this control for a financial services application, and would like to replicate this effect. It looks like this:
3d Stair stepped Pie Chart http://www.freeimagehosting.net/uploads/87a5caabca.png
I'd post some code on what I've accomplished so far, but I have no idea where to start with this. I'm guessing maybe I'd have to create the 3 charts, and offset their axes, am I off base here? Any help would be appreciated.
You need to create 3 seperate series and assign them to seperate chart areas.
The chart areas need to stepped down the page using position.x and position.y
Other tricks include disabling the legend for the second and subsequent series.
To get the transparency affect you need to work at a data point level in the series. Note the Ownership data point is not transparent but the renting and leasing data points are.

Categories