Profile Picture

Auto save chart as PNG?

Posted By Jonathan Green 8 Years Ago
Author
Message
Jonathan Green
Posted 8 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 6, Visits: 12
Is it possible to save charts as PNG images automatically to a temp dir?

And or render the chart as a temp file and control the filename?

Nevron Support
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)

Group: Forum Members
Last Active: 12 hours ago
Posts: 2,994, Visits: 3,512
Yes - you can do that with custom C# injected in the control. As the code is executed after the chart is populated with data and before the actual rendering, you can save to arbitrary image. You can have a 0x0 render Width & Height to avoid any output to the browser.

Why do you need to do that? What is the actual scenario?

Best Regards,
Nevron Support Team



Jonathan Green
Posted 8 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 6, Visits: 12
Hi we generate all our charts with nevron in SharePoint.

We would like to leverage this work by re using the charts for a separate
mobile site( not based on Sharepoint).

If the charts are available in png format and we are able to specify
The file names then we would be are to grab them and use then on our mobile site.

Nevron Support
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)

Group: Forum Members
Last Active: 12 hours ago
Posts: 2,994, Visits: 3,512
This is a very strange requirement, but anyway you may not need to go through a temporary file to do that.

First the Chart Web Part is fully AJAXed, meaning that even the generated images are served defferly in separate POST requests.
For modern browsers (IE 8.0 and higher, Chrome, FF, etc.) the images are usually packed in the response (as base64 encoded images).
Anyway the server command that generates HTML that contains a generated image is RefreshWebPart.

So it may be only necessary to send an HTTP request to the SharePoint server and the NChartCommander.aspx handler,
and it will respond with an HTML that you need to embed in your HTML page. This of course means that the SharePoint site running the chart is kind of public.

Of course there may be more details about this type of integration, but I think we can implement them as part of our consulting services.
Please contact sales@nevron.com if you are interested in having Nevron develop this type of integration for you.


Best Regards,
Nevron Support Team



Jonathan Green
Posted 8 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 6, Visits: 12
The SharePoint site would not be public.

We simply need to generate named png images of the nevron charts that we have created in SharePoint to a temp folder.

We would then use a script to push the png images to our mobile site.

This look to be possible with the .net version but not with the SharePoint version of nevron?



Nevron Support
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)Supreme Being (4,186 reputation)

Group: Forum Members
Last Active: 12 hours ago
Posts: 2,994, Visits: 3,512

This code will help you automatically save your charts as .png files on the server:

using System.Drawing;
using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.Chart.View;
using Nevron.ReportingServices;

namespace MyNamespace
{
                /// <summary>
                /// Sample class
                /// </summary>
                public class MyClass
                {
                                /// <summary>
                                /// Main entry point
                                /// </summary>
                                /// <param name="context"></param>
                                public static void RSMain(NRSChartCodeContext context)
                                {
                                                using (NChartRasterView view = new NChartRasterView(context.Document, new NSize(400, 300), NResolution.ScreenResolution))
                                                {
                                                                using (NRasterImage image = view.RenderImage(new NPngImageFormat()))
                                                                {
                                                                                image.SaveToFile("c:\\chartimage.png", new NPngImageFormat());
                                                                }
                                                }
                                }
                }
}



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic