Jump to content
Software FX Community

"Remembering" Statistical Study Settings...


FP2006

Recommended Posts

 

We have charts were users can optional show and configure the stat extension.  We allow users to save their settings (both core ChartFx object and Stat Settings) and reuse them as the data from our application is refreshed.  We implement this with the FileContents with both the Extensions and Reuse Extensions settings turned on.

 When we do this all of the chart settings (colors, fonts, etc.) are remembered when we reload the XML files. However, the Statistical Study settings are cleared.

So if I have a bar chart where the user has turned on the "mean", the next time the data is refreshed, the system respects all of the customizations made to the chart by the user except for the fact that the "mean" should be displayed.

 The following code is what is being used for the FileContents setting...

Me.FileContents = ChartFX.WinForms.FileContents.All

Me.FileContents = ChartFX.WinForms.FileContents.General Or ChartFX.WinForms.FileContents.Fonts Or ChartFX.WinForms.FileContents.Scale Or ChartFX.WinForms.FileContents.ColorsAndStyles Or ChartFX.WinForms.FileContents.SeriesAttributes Or ChartFX.WinForms.FileContents.PerPointAttributes Or ChartFX.WinForms.FileContents.DockableBars Or ChartFX.WinForms.FileContents.Extensions Or ChartFX.WinForms.FileContents.Pictures Or ChartFX.WinForms.FileContents.AxisSections Or ChartFX.WinForms.FileContents.CustomGridlines Or ChartFX.WinForms.FileContents.ReuseExtensions

 Any thoughts?  Thanks for the help.

Link to comment
Share on other sites

We are unable to reproduce this problem.

I tried creating a chart, added some studies, then saved the chart into an XML. Later, I imported the XML into a brand new chart and all the studies were there.

Please post a sample application that reproduces the problem.

Link to comment
Share on other sites

  • 7 months later...

 I think the issue appears when you import the XML settings into a chart that already has a statistical extension turned on.  It looks like you imported to a completely new chart.

Below are the code snippets we are using...

 

 

Public Sub SaveLayout(ByRef PropertyBag As String, ByVal View As Integer) Implements Framework.Reporting.IDisplayObject.SaveLayout


 
Dim DisplayPropertyBag As
Utilities.XMLSettings


 
Dim Settings As
String


 


 
'Lets initialize the property bag


 
DisplayPropertyBag = New Utilities.XMLSettings("Display", PropertyBag)


 


 
Settings = Me.GetUserSettings


 
DisplayPropertyBag.WriteSettings("ChartLayout",
Me.Name & "-("
& View.ToString & ")",
Settings, GetType(System.String))


 


 
PropertyBag = DisplayPropertyBag.XML


 End Sub


 


 


 Public Function GetUserSettings() As
String


 
Dim MS As
System.IO.MemoryStream


 
Dim MSR As
System.IO.StreamReader


 


 


 
Try


 
MS = New System.IO.MemoryStream


 


 
Me.FileContents =
ChartFX.WinForms.FileContents.All


 


 
Me.FileContents =
ChartFX.WinForms.FileContents.General Or
ChartFX.WinForms.FileContents.Fonts Or
ChartFX.WinForms.FileContents.Scale Or
ChartFX.WinForms.FileContents.ColorsAndStyles Or
ChartFX.WinForms.FileContents.SeriesAttributes Or
ChartFX.WinForms.FileContents.PerPointAttributes Or
ChartFX.WinForms.FileContents.DockableBars Or
ChartFX.WinForms.FileContents.Extensions Or
ChartFX.WinForms.FileContents.Pictures Or
ChartFX.WinForms.FileContents.AxisSections Or
ChartFX.WinForms.FileContents.CustomGridlines Or
ChartFX.WinForms.FileContents.ReuseExtensions


 



 Me.Export(FileFormat.Xml,
MS)


 


 
MSR = New System.IO.StreamReader(MS)


 
MS.Position = 0


 
Return MSR.ReadToEnd


 
Catch ex As
System.Exception


 
Return ""


 
End Try


 



End Function


 


 


 


Public Sub SetUserSettings(ByVal
Settings As String)


 
Dim MS As
System.IO.MemoryStream


 
Dim MSW As System.IO.StreamWriter


 


 
MS = New System.IO.MemoryStream


 
MSW = New System.IO.StreamWriter(MS)


 


 
MSW.Write(Settings)


 
MSW.Flush()


 
MS.Position = 0


 


 
Dim MSR As
System.IO.StreamReader


 
MSR = New System.IO.StreamReader(MS)


 
MS.Position = 0


 


 
Me.Import(FileFormat.Xml, MS)


 


 
Me.RecalculateScale()



End Sub


 


 


  Public Sub
ApplySavedChartLayout(ByVal PropertyBag As String, ByVal View As Integer) Implements
Framework.Reporting.IDisplayObject.ApplySavedChartLayout


 
Dim DisplayPropertyBag As
Utilities.XMLSettings


 
Dim Settings As
String


 


 
'Lets initialize the property bag


 
DisplayPropertyBag = New Utilities.XMLSettings("Display", PropertyBag)


 


 
Settings = DisplayPropertyBag.GetSettings("ChartLayout",
Me.Name & "-("
& View.ToString & ")", "", GetType(System.String))


 
If Settings <> ""
Then Me.SetUserSettings(Settings)


 
End Sub




 

Link to comment
Share on other sites

  • 2 weeks later...

 I saw this response in the "extensions" forum.  Is it related?

 

Adding the .clear did not fix the issue for us, so I am wondering if it is something in the code snipets we sent that we are doing wrong.

 

thanks for the help! 

 ---------------------------------------------------------------------------------------

There'sseems to be a problem importing a financial or statistical chart to achart that has one of these extensions already added. Please call theClear() method of the Extensions object before calling the Import()method. You can do as follows:

 chart1.Extensions.Clear();

chart1.Import(FileFormat.Binary, "D:\\Temp\\StatisticalExport.bin");

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...