Jump to content
Software FX Community

How to export a ChartFX 7 Map as an image


Recommended Posts


In ChartFX 6.2, I export a Map that contains the underlying data along with the ConditionalAttributes using the GetHtmlTag() method. In ChartFX 7, I wasn't able to find a method that performs this operation. None of the Export methods of the underlying Chart class (it looks likethe Map class now has a Chart object as a member instead of inheriting from the Chart class), were able to export the "processed" SVG file (i.e. the equivalent of the output of the GetHtmlTag() method in ChartFX 6.2).

Please help.


Link to comment
Share on other sites

Hi Frank, 

Thanks for the quick reply.

Unfortunately, I had tried both options. By the way, what do you mean by "Map extension is attached"?

Option 1++++

map1 = new Map();

chart1 = new Chart();

map1.Chart = chart1;


StringBuilder sb = new StringBuilder();

StringWriter oStringWriter = new StringWriter(sb);System.Web.UI.HtmlTextWriter oWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);

map1.RenderControl(oWriter);return sb.ToString();


sb.ToString() was empty.


Option 2+++++++

chart1.Export( FileFormat.Png, "C:\temp\map.png")  returned a regular Line Chart.

using one of the samples that came with the installation,  I was able to find that the Map gallery corresponds to 29959, so I tried the following:

chart1.Gallery = (Gallery)29959;

chart1.Export( FileFormat.Png, "C:\temp\map.png")

In this case, I was able to get a Map output but it didn't have the SVG geography labels, not to mention this hack will break as soon as the internal representation of the Map gallery changes to a different integer.




Thanks for all your help.


Link to comment
Share on other sites

> By the way, what do you mean by "Map extension is attached"?

map1.Chart = chart1;

Attach the map extension to the chart.

You need to call RenderControl on the Chart object, not on the Map object.

I don't see any code here (maybe is not posted) where you select the map you want, the data, etc. It seems that some code is resetting the gallery back to line (the gallery is set to Map when you attach the extension).

I will need a full project that reproduces the situation in order to determine what's going wrong.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...