2

I've done a number of asp.net webforms projects, and any charting/grid type stuff I have achieved with server side controls such as Telerik which have nicely taken care of the client side. However, there are some amazing viz libraries such as D3 (http://mbostock.github.com/d3/ex/) and javascript infovis toolkit (http://thejit.org/).

I'd love to give them a go; I've had some limited experience with Java in addition to C#, and normally massage my data into a collection using LINQ. I have a general idea of what JSON is but haven't seen how to plumb it all together. The java world tends not to talk much about .NET integration though, for understandable reasons.

Does anyone know of any example projects or getting started guides that would demonstrate how to take a Linq collection (lets say a collection of simple objects each containing name, and salary values), throwing that out via JSON or whatever is needed, and then consuming and displaying it on the client side with one of these javascript libraries?

Thanks!

PS. I've tagged this with JSON but that's a guess, feel free to retag...

1
  • Thanks for the comments guys. Basically, I'm after a super simple code example of taking a collection of data from the server side up into the client side and into a simple js visual toolkit. Any takers? Commented Jun 14, 2011 at 5:52

2 Answers 2

1

from a 10,000 foot view, look at writing a wcf web service. if you're your returning a collection like a List<> or something of that nature wcf will automatically serialize it to json for you, just tag it with [WebGet(ResponseFormat = WebMessageFormat.Json)] to specify that it should allow get requests and respond to them with json.

if you're using asp.net mvc and you don't want the overhead of a separate web service, add an action to your controller that returns a JsonResult. then you just return new Json(myListVariable); and you're done, properly formatted json sent to your web page.

i suppose i'm assuming you know how to make an ajax request... if not, download jquery, and look up $.post.

finally, if you're really looking for a cool graphing library, and you're cool with html5 being a requirement, check out gRaphael. its really neat.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for that Nathan. I've got that general idea but from experience know it'll take me 2 days to try to construct it. Any kind of example vs solution for example that implements such a library is what I'm on the search for.
my advice would be to spend the 2 days so that you'll understand it. there are plenty of tutorials for setting up a wcf web service, just gooogle it, and the documentation for $.post is good. after that its just a matter of reading the documentation for whatever library you end up choosing and plugging the data in properly.
0

I don't have any experience or resources for the library you are considering to use, but Google has real good examples for their charting libraries.

http://code.google.com/apis/chart/interactive/docs/examples.html

2 Comments

There are examples there on howto get JSON responses from server side libraries, I thought it might give him a general idea.
Thanks for that. I've got more libraries than I can poke a stick at but how to practically implement them in VS with c#.net is the crux of the inquiry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.