开发者

Graphs and ASP.Net MVC

I have a graph which I would like to represent using an image on a website. The problem is generating this image dynamically based on the current state of the graph.

I'm using ASP开发者_开发百科.Net MVC 3 with C#.

I've been thinking about generating the image on the harddisk using some tool(Graphviz etc.) and then passing the path of the file to the view.

Security isn't a real issue, as this is just internal project based work for now, it is much more important that its easy to implement.

I've been trying quickgraph, and eventually i've had it generating DOT files (apperently it ignores my attempts to make PNG's) but the code fails because the program don't have access to where the files are generated. I suppose this is easy to fix, though.

Do you have any suggestions to how I could do this (If i should do something completely different or how i can get the DOT files rendered as PNG)?

Best regards, Daniel


Just wanted to note that I solved this using the Google Image Chart, they have experimental Graphviz support: http://code.google.com/apis/chart/image/docs/gallery/graphviz.html

Simply generate an URL and insert an external image on your page.


If the graph library allows you, write the result to a memory stream and place it in the Cache (System.Web.HttpRuntime.Cache) with a key.

Use that key to generate the img tag in the view and point to an action ('View'?) in a controller ('Image') like "/Image/View/392838".

Create this controller and view and serve the contents (make sure to include proper MIME type, content type etc.) from there.

In the cache specify a decent lifetime for the object, such as 15 seconds, sliding expiration.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜