Tag Archives: chart

FusionCharts: Invalid Data when using javascript renderer (solved)

If you’re using FusionCharts you may encounter a strange issue – chart renders correctly when Flash renderer is in use and displays “Invalid Data” error message when falling back (or forced) to JavaScript renderer.

In most cases culprit is invalid XML data passed to the engine. And while Flash is more forgiving, JavaScript requires strict valid XML. Most often the cause for the issue are characters invalid in XML. Check your data and if they contain following characters – replace them with their encoded values:

" (quote) --> "
' (apostrophe) --> '
< (less sign) --> &lt;
> (greater sign) --> &gt;
& (ampersand)  --> &amp;

And the error will disappear.

Happy charting!

FusionCharts: Use non-numeric Xaxis in Bubble and Scatter Charts

FusionCharts states in their documentation that in Bubble and Scatter Charts both X-Axis and Y-Axis must be numeric. But what if you want X-Axis to display some names or dates or other non-numeric values? That is still possible via label attribute of chart’s categories element.

The method below utilizes ADO.NET/VB.NET to build XML for chart data, but similar approach can be easily used in other languages/technologies.

Consider the following ADO.NET DataTable, called dtChartData:

               Login Failure  Login Success
-------------- -------------- -------------
2013-03-27     1              69
2013-03-26     0              32
2013-03-25     1              86
2013-03-22     0              11

It holds data for number of successful/unsucessful logins for a given date. We want to display this data as a Bubble chart with dates displayed on X-Axis. Continue reading →

(Possible) solution for MSChart ArgumentException The image is not found error

If you’re using Microsoft’s .NET charting control on your ASP.NET pages you may receive an annoying error

[ArgumentException]: The image is not found. at
System.Web.UI.DataVisualization.Charting.ChartHttpHandler.ProcessSavedChartImage(HttpContext context) at
System.Web.UI.DataVisualization.Charting.ChartHttpHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I could be intermittent, sometimes happen, sometimes not. In your web.config you already set your temp images to be stored as files and not deleted after serving:

<add key="ChartImageHandler" value="storage=file;timeout=20;url=~/temp/;deleteAfterServicing=false" />

as well as trying other remedies and nothing helps.

One possible solution is, while still using file temp storage, instead of indicating relative path via url property set it to absolute path via dir property:

<add key="ChartImageHandler" value="storage=file;timeout=20;dir=C:\TEMP;deleteAfterServicing=false" />

In the example above C:\TEMP is an absolute path to the temp folder on the Web Server. In your case it could be different; in multi-server (WebFarm) environment it should be a network share, accessible by all servers.

ASP.NET Chart Control is not rendering image

If you’re using MS Chart Control for .NET Framework 3.5 SP1 (in .NET Framework 4.0 it comes as a part of a framework), you may experience a strange behavior when chart images aren’t rendered on the page:

Chart image isn't rendering

If you’re using HTTP Handler to serve chart images (image URL looks something like “…/ChartImg.axd?i=chart_24dae5cb1f024c4a89f4fe492f05cc59_0.png“) missing mapping in IIS configuration could be to blame Continue reading →

Serving image from ASP.NET MSChart to external applications via WebService

I have an existing ASP.NET application that uses Microsoft Charting control for .NET. I created a CCharting class that hold several methods related to getting data for the chart, applying chart appearance etc. Main method of that class is

Public Sub DrawChart(ByVal i_omsChart As Chart, ByVal i_iChartWidth As Integer, ByVal i_iChartHeight As Integer)

As a 1st parameter it accepts actual chart control from the page, 2nd and 3rd are chart width and height. The method then gets the data for the chart, binds chart to that data, applies chart appearance (colors, series, axises) etc. So drawing a chart is a simple as instantiating the class and calling the method:

Dim oCharting As New CCharting
CCharting.DrawChart(xmsChart,500,300)

where xmsChart is a chart control from HTML markup of the page. The result is displayed on the page:

But now I needed to give access to that chart to external applications, that do not have access neither to chart data nor to Microsoft charting control, may run under different OS’s, be Web apps or not. Continue reading →

Microsoft Chart for ASP.NET 3.5: Correctly setting image storage location

If you’re using Microsoft Chart control for .NET 3.5 you can specify where and how chart images are stored. And if for this purpose you’re trying to use Chart HTTP Handler setting in web config similar to this:

<add key="ChartImageHandler" value="storage=file;url=./Temp"/>

and it is failing (for example chart images are alway created in the root folder of your Web application) – there is an alternative. You can specify location of the images in properties of the chart control itself:

Just add relative path to your storage folder in front of the chart sequence string in “ImageLocation” property. and specify “UseImageLocation” for “ImageStorageMode” property