Jump to content
Software FX Community

exporting and importing chart templates


jim.leavitt@romac.com
 Share

Recommended Posts

Hi,

I've got a web application that needs to load 100's of charts. I want to be able to export the chart format and then import it when a chart has been called. I'm reusing charts on my web page. I can do it manually by setting the properties, but I can ease my object inheritance tree by being able to specify a file that configures the chart format.

I've tried:

import - export with xml file format. I get this error trying to import the xml file:

System.FormatException was unhandled by user code

  Message="Input string was not in a correct format."

  Source="mscorlib"

  StackTrace:

at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)

at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)

at System.Int32.Parse(String s, IFormatProvider provider)

at ChartFX.WebForms.b.a(String A_0, Int32& A_1, Int32 A_2)

at ChartFX.WebForms.ImageSettings.a(Boolean A_0, IPersistBase A_1)

at ChartFX.WebForms.b.a(String A_0, Object A_1, String A_2, ObjFlags A_3)

at ChartFX.WebForms.b.b(String A_0, Object A_1, String A_2, ObjFlags A_3)

at ChartFX.WebForms.Chart.a(IPersistBase A_0, Boolean A_1)

at ChartFX.WebForms.Chart.c(Boolean A_0, IPersistBase A_1)

at ChartFX.WebForms.Chart.Import(IPersistBase pers)

at ChartFX.WebForms.Chart.Import(FileFormat format, Stream stream)

at ChartFX.WebForms.Chart.Import(FileFormat format, String fileName)

at base.doConsolidatedSales(String chartName, String sAction) in C:\Documents and Settings\Jim\My Documents\Visual Studio 2005\WebSites\Dashboard\base.aspx.vb:line 173

at base.Chart1_UserCallback(Object sender, UserCallbackEventArgs e) in C:\Documents and Settings\Jim\My Documents\Visual Studio 2005\WebSites\Dashboard\base.aspx.vb:line 25

at ChartFX.WebForms.Chart.OnUserCallback(UserCallbackEventArgs e)

at ChartFX.WebForms.Chart.b(String A_0)

at ChartFX.WebForms.Chart.h(String A_0)

at ChartFX.WebForms.Chart.o(String A_0)

How can I import chart formats from disk files to set up generic charts for new data loads?

btw, where does chartfx save personalization templates? I've considered trying to use that interface as well

Thanks, Jim Leavitt

Link to comment
Share on other sites

Please attach the XML file that's causing the problem.

 As for where the personalization settings get saved:

1) If you are uisng the .NET client component you can chose to store them in the client's isolated storage (default).

2) You can also save them server-side by capturing the Personalized event. The following KB article offers a good guide for implementing this:

Q7621005. Saving Chart FX Personalization in ASP.NET profiles

URL: http://support.softwarefx.com/ShowArticleSep.aspx?Type=KB&Product=CfxNet70&Source=http://support.softwarefx.com/kb/762/1/005.htm?_r=1

 

Link to comment
Share on other sites

Thank you for the reply!

I found the .chf files in isolated storage. I suppose I'd like to generate a chf file for each chart format and then use my code to load it whenever necessary.

I tried to

Chart1.TemplateControl.LoadTemplate(

"/Dashboard/chart1.chf")

however I get this exception: (which is probably expected and I'm fighting my way through this project)

{"There is no build provider registered for the extension '.chf'. You can register one in the <compilation><buildProviders> section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'."}

Here's the xml file that fails to load..  Thanks, Jim Leavitt

<?xml version="1.0" encoding="UTF-8"?>

<CFX7> <PLOTAREACOLOR>#501f1f1f</PLOTAREACOLOR> <PAGECOLOR>#ff000000</PAGECOLOR> <PANES> <ITEM index="0">  <AXES> <ITEM index="0">  <LABELSFORMAT> <FORMAT>Currency</FORMAT>  </LABELSFORMAT>  <GRIDS> <INTERLACED>True</INTERLACED> <INTERLACEDCOLOR>#ff303030</INTERLACEDCOLOR>  </GRIDS>  <TITLE> <TEXT>Sales Dollars</TEXT>  </TITLE> </ITEM> <ITEM index="1">  <LABELSFORMAT> <FORMAT>Percentage</FORMAT>  </LABELSFORMAT>  <TITLE> <TEXT>Margins</TEXT>  </TITLE> </ITEM>  </AXES> </ITEM> </PANES> <AXESX> <ITEM index="0">  <STYLE>SingleLine, BreakZero, LongTick, AutoScale, ForceZero, RoundStep, DetectArea, AutoMinorStep, AutoFirstLabel, AutoCenter, AllowHalf, HighlightValues</STYLE>  <LABELSFORMAT> <FORMAT>Date</FORMAT>  </LABELSFORMAT>  <LABELANGLE>45</LABELANGLE> </ITEM> </AXESX> <ALLSERIES> <GALLERYARRAY type="ChartFX.WebForms.Internal.IGalleryType[]">  <ITEM index="0" type="ChartFX.WebForms.Galleries.Line"/> </GALLERYARRAY> </ALLSERIES> <SERIES> <ITEM index="0">  <TEXT>BUDGET</TEXT> </ITEM> <ITEM index="1">  <TEXT>ACTUAL</TEXT> </ITEM> <ITEM index="2">  <TEXT>TOC_Cntrb</TEXT> </ITEM> <ITEM index="3">  <TEXT>GAAP_Cntrb</TEXT> </ITEM> <ITEM index="4">  <AXISY>1</AXISY>  <TEXT>FT_MARGIN</TEXT> </ITEM> <ITEM index="5">  <AXISY>1</AXISY>  <TEXT>GAAP_MARGIN</TEXT> </ITEM> </SERIES> <TITLES> <ITEM>  <TEXT>Consolidated Sales</TEXT>  <FONT> <SIZE>12</SIZE>  </FONT> </ITEM> </TITLES> <PALETTE>HighContrast.HighContrast</PALETTE> <LEGENDBOX> <DOCK>Bottom</DOCK> </LEGENDBOX> <BORDER type="ChartFX.WebForms.Adornments.ImageBorder" assembly="ChartFX.WebForms.Adornments, Version=7.0.2893.24805, Culture=neutral, PublicKeyToken=a1878e2052c08dce"> <COLOR>#ff000000</COLOR> </BORDER> <BACKGROUND type="ChartFX.WebForms.Adornments.GradientBackground" assembly="ChartFX.WebForms.Adornments, Version=7.0.2893.24805, Culture=neutral, PublicKeyToken=a1878e2052c08dce"> <COLORS type="ChartFX.WebForms.Adornments.GradientBackground+ColorCollection" assembly="ChartFX.WebForms.Adornments, Version=7.0.2893.24805, Culture=neutral, PublicKeyToken=a1878e2052c08dce">  <ITEM> 192, 192, 192  </ITEM>  <ITEM> 0, 0, 0  </ITEM> </COLORS> </BACKGROUND> <ID>Chart1</ID> <IMAGESETTINGS> 100 True </IMAGESETTINGS> <RENDERFORMAT>Auto</RENDERFORMAT></CFX7>

Link to comment
Share on other sites

I didn't quite catch the entire first line of the xmlfile... here's the first line (and the rest of the file again)...  thanks, Jim Leavitt

<?xml version="1.0" encoding="UTF-8"?><?xml version="1.0" encoding="UTF-8"?>

<CFX7>

 <VIEW3D>

<ENABLED>True</ENABLED>

<ROTATED>True</ROTATED>

<CLUSTER>True</CLUSTER>

 </VIEW3D>

 <PANES>

<ITEM index="0">

 <AXES>

<ITEM index="0">

 <LABELSFORMAT>

<FORMAT>Currency</FORMAT>

 </LABELSFORMAT>

 <GRIDS>

<INTERLACED>True</INTERLACED>

<INTERLACEDCOLOR>#ff404040</INTERLACEDCOLOR>

 </GRIDS>

 <TEXTCOLOR>Silver</TEXTCOLOR>

 <TITLE>

<TEXT>Sales Dollars</TEXT>

 </TITLE>

</ITEM>

<ITEM index="1">

 <LABELSFORMAT>

<FORMAT>Percentage</FORMAT>

 </LABELSFORMAT>

 <TITLE>

<TEXT>Margins</TEXT>

 </TITLE>

</ITEM>

 </AXES>

</ITEM>

 </PANES>

 <AXESX>

<ITEM index="0">

 <STYLE>SingleLine, BreakZero, LongTick, AutoScale, ForceZero, RoundStep, DetectArea, AutoMinorStep, AutoFirstLabel, AutoCenter, AllowHalf, HighlightValues</STYLE>

 <LABELSFORMAT>

<FORMAT>Date</FORMAT>

 </LABELSFORMAT>

 <LABELANGLE>45</LABELANGLE>

 <TITLE>

<TEXT>Date of Sale</TEXT>

 </TITLE>

</ITEM>

 </AXESX>

 <ALLSERIES>

<GALLERYARRAY type="ChartFX.WebForms.Internal.IGalleryType[]">

 <ITEM index="0" type="ChartFX.WebForms.Galleries.Line"/>

</GALLERYARRAY>

 </ALLSERIES>

 <SERIES>

<ITEM index="0">

 <TEXT>BUDGET</TEXT>

</ITEM>

<ITEM index="1">

 <TEXT>ACTUAL</TEXT>

</ITEM>

<ITEM index="2">

 <TEXT>TOC_Cntrb</TEXT>

</ITEM>

<ITEM index="3">

 <TEXT>GAAP_Cntrb</TEXT>

</ITEM>

<ITEM index="4">

 <AXISY>1</AXISY>

 <TEXT>FT_MARGIN</TEXT>

</ITEM>

<ITEM index="5">

 <AXISY>1</AXISY>

 <TEXT>GAAP_MARGIN</TEXT>

</ITEM>

 </SERIES>

 <TITLES>

<ITEM>

 <TEXT>Consolidated Sales for 06-2008</TEXT>

</ITEM>

 </TITLES>

 <PALETTE>HighContrast.HighContrast</PALETTE>

 <TOOLBAR>

<VISIBLE>True</VISIBLE>

 </TOOLBAR>

 <LEGENDBOX>

<DOCK>Bottom</DOCK>

 </LEGENDBOX>

 <BORDER type="ChartFX.WebForms.Adornments.SimpleBorder" assembly="ChartFX.WebForms.Adornments, Version=7.0.2893.24805, Culture=neutral, PublicKeyToken=a1878e2052c08dce">

<TYPE>None</TYPE>

<COLOR>#ff6d7d8a</COLOR>

 </BORDER>

 <BACKGROUND type="ChartFX.WebForms.Adornments.GradientBackground" assembly="ChartFX.WebForms.Adornments, Version=7.0.2893.24805, Culture=neutral, PublicKeyToken=a1878e2052c08dce">

<COLORS type="ChartFX.WebForms.Adornments.GradientBackground+ColorCollection" assembly="ChartFX.WebForms.Adornments, Version=7.0.2893.24805, Culture=neutral, PublicKeyToken=a1878e2052c08dce">

 <ITEM>

Silver

 </ITEM>

 <ITEM>

Black

 </ITEM>

</COLORS>

 </BACKGROUND>

 <ID>ctl00$ContentPlaceHolderGraph$Chart1</ID>

 <IMAGESETTINGS>

True

 </IMAGESETTINGS>

 <RENDERFORMAT>Auto</RENDERFORMAT>

</CFX7>

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.

Guest
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.

 Share

×
×
  • Create New...