I am currently doing an mvc3 razor project and I need some charts.
I will need to blend bars and lines in a single chart or/and have multiple dataseries.
I was just wondering which charts you guys use. Price is a factor but I would like to hear some real world usage before trying out to many of the thousands of the charts available.
We're currently using Google Chart Tools. It uses HTML5/SVG technology (adopting VML for old IE versions) so it's all rendered on the browser. The JavaScript API is really powerful yet pretty simple to understand and very flexible allowing you to customize almost everything from the data to the presentation. Because it's all rendered in browser it also offers very nice and clean animations on mouse-over and mouse-click.
You've detailed documentation for each type of chart.
Check the default charts here. Also available are the Additional Charts which are compliant with DataTable protocol (a way to represent charts data through JavaScript) and are somehow approved by Google.
It's free!
I've used HighCharts before and find the API very nice to use, also as its essentially a Jquery plugin using a JSON result in your Razor view would integrate nicely.
You can use the ASP.Net chart controls in an MVC Razor project, although not quite as easily as it is in .aspx pages.
See Charts in ASP.Net MVC 2 With Drill-Down! for an example using .aspx syntax that can easily be converted to Razor syntax.
Related
There are plenty of Wordpress template out there, most of them are well designed.
I like to know, is there a way to easy to use Wordpress template in c# project.
Is there any out-of-the-box solution?
Just grab a copy of the output HTML and the CSS of the WP site and apply/build your ASP.NET site around it. This is straightforward in itself. Where most people get confused is when there's a master page in the mix in ASPNET; however, this is not a problem. Just start (with the HTML produced by the WP site) by creating the main divs working from the outside-in, using the master page and then content areas in your pages. Master page(s) will generally contain display elements common to all or a subset of pages.
No, there is nothing "out-of-the-box".
You will need to write your own converter if you wish to do this, though translating a single page shouldn't be too difficult.
I wish to use Google organisational chart within my ASP.NET MVC project. I am however finding it difficult to get my head around how this would fit into the MVC architecture.
The Javascript to generate the chart will be contained in the head of my file and as this data will reguarly change, it needs to dynamically be created. Can anyone give me any tips on where to begin with this?
take a look at this page. Scott Gu talks about Sections in MVC 3. I've used this before to create a section in the head tag to place script block/styles that apply to only one page, this gives you the freedom to use page specific script/styles without make your DOM a jumbled mess.
I'm currently having a couple of reports which I print from my Forms applications.
However building printed reports only with the built-in .NET printing methods is very tedious. Even just printing a simple table on a couple of pages with a little bit of formatting is a task for a couple of hours (if it should look nice).
What I need is a WYSIWYG-Designer for the layouts, so I'd like to write one.
It shouldn't be for End-Users, but for me as a developer, it's just about to create the layout what the report will look like with various arrangements/fonts/images/formats and so on and not have to do that by trial & error in code (and restart the app a zillion times).
So my specific questions:
What would I use as a canvas for editing and display of the report? An image-control/bitmap which I draw upon like on the printed document? Is there a better way?
Is drawing on a form comparable to drawing on a printed page? What about differences in resolution printer vs. screen?
How to get real WYSIWYG? Should I get the printer settings and create my canvas with the same resolution? Is there something else to consider?
I know that there are report designers around but I think it's sometimes good to understand the basic working principles of what you use and implementing them is for me the best way to do that.
I'm aware that this is not a specific question A to which the answer is always B, but if it were that way I would find an answer in Google pretty quickly.
Thanks in advance!
I can't say much about designing a WYSIWYG editor, but I have written a few custom in-house reporting engines for use by our development team.
There's two main ways I've created reports. The first is using PDFsharp (MIT-licensed) to manually layout pages which isn't for the faint-of-heart.
The second is using Winnovative's HTML to PDF library (not free, but royalty-free) which uses the current installed version of IE to do the layout and spit out a PDF. It looks like they've recently released a new version called EVO PDF which I have never used before.*
For the HTML to PDF solution, it supports JavaScript so you can add in charts from JavaScript libraries like flot or jqplot.
*I'm not affiliated with Winnovative.
You might want to save time and use Visual Studio HTML designer as your WYSIWYG editor.
What I'm currently doing is using ASP.NET MVC 3 as a simple reporting engine. You can use the MVC pattern to really separate your reporting data source (Model) and the rendering (View) while using Visual Studio as your report designer.
From your application you can easily call your actions with the report optional parameters. For example:
http://localhost/Report/Customer/Orders/1
You simply get the returning string from a WebClient's DownloadString method and you have your report generated.
There is some down side using HTML, mainly the difficulties to know when a page would break, but by using code in your View you can calculate the amount of repeating items and add a CSS break-page and re-starting your table's header on the next page.
You can achieve anything from graphics, to table, you can even generate link to other reports.
HTH.
Printing Reports in Windows Forms
http://msdn.microsoft.com/en-us/library/ms996472.aspx
I've got a site which produces charts such as the one below
I'd like to encourage visitors to embed the generated graphic on their own sites and blogs. Is it possible to include views for that chart in google Analytics? I want to be able to see when a site embeds the image so that it's tracked in the analytics reports.
I'd envision some API that I can call from the server-side method which generates the PNG, but haven't been able to find anything specific.
Thanks!
This is indeed possible, have a look at the Google Analytics for Mobile Websites documentation. This details how to build a request to google analytics on the server, with quite a few different code samples (C# included).
While this documentation revolves around tracking page views, this concept could be extended to other types of activity you can record in google analytics, such as Events. In your specific situation I think I would want to setup the view of the chart as an Event, as this will not 'mess up' your true traffic (though you could use an advanced segment to exclude the chart traffic if you chose to register them as page views).
The documentation for event tracking is available here. Looking through it should give you a good idea of how you could express viewing your charts. Once you got an idea of how you wanted to track the event in GA, write the javascript and then view the URL (beacon) it generates to send the information to google. You'll be able to use that as a template to send event information from the server.
In regards to actually serving the image, you have a lot of options. If you app is written in MVC, look at the FileResult class (and the asssociated File() method available on the Controller class). If you working in a Webforms app, you will be using a Response.WriteFile() or something to that affect. This wrox article has an example of the idea behind this. The example is for creating a no leaching / hotlinking image handler, but the concept of writing an image to the HttpReponse is the same.
I haven't worked with MVC3 that much - as it was just released, but I was wondering if there was some kind of conversion tool - to convert exisiting Views / Forms into the newer up-to-date "Razor" view engine.
I'm not sure if it is possible but I just thought this would be the place to ask...
Thanks!
I recently read on Dave Hayden's blog this morning about Telerik releasing a Razor View Conversion tool. I believe they used it to convert all of their demos on their site from all of their existing WebForm view to the new Razor View engine.
Here is Dave's short blurb regarding the tool and if you want to play around with it yourself, it is available on Github using the following link:
Github - Telerik Razor Conversion Tool
Hope this helps you out (I haven't had the chance to play around with it much - but knowing Telerik, it's probably pretty decent.)
Given that Asp.net webforms works well for simple pages and there is no point in moving to MVC for the sake of it. I don't think a converter will do a good job, as:
your pages are complex
and/or you wish to do unit testing - so need to redesign
or you are moving for the sake of it (way?)