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);
Related
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.
I'm trying to create candle stick chart using zedgraphweb and having below problems.
How to add horizontal scroll bar to chart. There are methods for this for ZEDGRAPH but none in zedgraphweb.
How to refresh just graph to render real time data with out page refresh. Calling this.ZedGraphWeb1.RenderGraph += new ZedGraph.Web.ZedGraphWebControlEventHandler(this.OnRenderGraph); refreshing the entire graph.
How to add tool tips?
Thanks,
Thavva
2) I don't know the differences between zedGraph and zedGraphWeb, but in zedGraph, the zedGraphControl.Refresh() method enables you to refresh the graph pane.
I am creating power point 2007 files using the openxml. I am able to add slides, shapes, text and manipulate them to create custom reports. However, I can not find an example on how to dynamically load an image into my power points. In principle I imagine that it would involve adding the image as a resource and then adding a reference to that resource. Any example code would be great help.
Thank you.
You will first need to add an ImagePart to your SlidePart like this:
ImagePart imagePart = slidePart.AddImagePart(ImagePartType.Png, "rId3");
The "rId3" needs to be the relationshipId that corresponds to your image that you are adding to the presentation. You could also leave that parameter blank and a default relationship id will be created for you. Next you need to feed that image part the actual image:
imagePart.FeedData(new MemoryStream(photo.ToArray()));
If you are still having trouble take a look at these two blog posts. They both show some code mid way down about adding photos to a presentation.
Creating a report presentation based on data
Adding repeating data to PowerPoint
I am currently developing an application in C# using the NPlot Charting Library.
I want to have a 2 bar charts side by side for each label across the X axis instead of them being stacked on top of each other.
Is this possible with Nplot, I couldn't find anything on Google but the Nplot documentation implies that you can have them side by side instead of stacked.
Thanks for any help you can provide.
Found out you change the bases offset i.e.
HistogramPlot myPlot = new HistogramPlot();
myplot.baseOffSet = 0.3f
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.