我的 Web 服务需要生成一些折线图,然后将这些折线图添加到流式传输到客户端的 PDF 报告中。
如何在 Web 服务中生成折线图?
谢谢!
我的 Web 服务需要生成一些折线图,然后将这些折线图添加到流式传输到客户端的 PDF 报告中。
如何在 Web 服务中生成折线图?
谢谢!
If you don't want to use a third party control then you can use the System.Drawing namespace for this.
Dont forget to dispose the graphics object as soon as you have finished with it (a using block is best)
Because you are using GDI+ from within a web service, you may want to consider using the Singleton pattern to serialise requests to do the drawing.
Have a look at this webpage here
Drawing Line Charts in ASP.Net
Then instead of requesting the chart from your page_load and returning it in the stream, return it from one of your webservice functions
Edit
Went away and thought about this and then a lightbulb went off - another way of doing this (and also removing you from the GDI+ code) would be to use the GoogleCharts api.
For example https://chart.apis.google.com/chart?cht=p3&chd=t:90,10&chs=250x100&chl=Overflow|Stack renders the following
Line charts
http://code.google.com/apis/chart/docs/gallery/line_charts.html
Also, if you haven't sorted PDF generation yet, have a look at iTextSharp here