Personalizing Charts

As commercial web sites, corporate intranets and client applications become more and more sophisticated, users require and demand information on an individual basis. This is one of the reasons why web sites and client applications are beginning to support customized content with individual topics of interest and other personal information.

When it comes to Chart FX, there are many attributes the user may customize for each chart. Picture this, a particular user likes the graphical capabilities of Chart FX in your application; there is, however, one minor issue that annoys him, which is the color scheme you have chosen for your charts. There is another user asking you to change your default bar chart for a line chart. You instruct them to use the Chart FX user interface to change the visual attributes of the chart every time they log on to your site.

But, wouldn't it be nice if your application could provide charts with visual attributes they like but with new data for subsequent visits?

Chart FX can deliver personalized charts to your users. here are two ways to provide personalized charts: using the Chart FX User Interface (UI) with a few clicks by the end-user, or totally automatic through the API.

Important Note: Personalize features are available only for active charts (.NET or ActiveX).

Personalizing a Chart using the User Interface

One of the options of the Chart FX toolbar is the PersonalizedCharts icon. It provides the user 3 options:

Load My Chart: when the user clicks on this option, any previously saved transformations will be applied to the new data. These transformations have been saved through either UI or API. If there are no transformations saved, no changes will be applied to the chart.

Save My Chart: when it's clicked, all the transformations made by the end-user to the original chart will be saved in a small file (approx. 1K) in the user's personal Isolated Storage. Isolated Storage is a concept introduced by .NET, and is located under the user's personal section of the local drive (Documents and Settings\...). For further details on how Isolated Storage works please refer to the .NET documentation.

Reset Defaults: this option clears all the transformations made by the end-user and resets the chart to the original look established in the application. By default this option is disabled but it will be enabled as soon as the end-user modifies any attribute of the chart or a saved chart is loaded.

Personalizing a Chart using the API

When chart personalization is applied through the UI, user intervention is required to save and apply the transformations. In many cases the developer wants to provide an automatic mechanism to save and apply those changes. Chart FX provides this through the PersonalizedFlags property. With this property, the developer has the ability to decide whether the changes will be saved and/or loaded automatically. The supported flags are:

PersonalizedFlags.AutoLoad: before the chart is rendered, Chart FX will look for a saved transformation file in the user's Isolated Storage, and will apply it to the new data if found. This functions as if the user selected the "Load My Chart" option. By default this option is disabled.

PersonalizedFlags.AutoSave: any transformations made to the chart will be automatically saved to the Isolated Storage when the chart is destroyed (the browser is refreshed or closed, or another page is invoked). By default this option is disabled.

PersonalizedFlags.EnableRestore: as soon as the user makes the first change to the chart through the UI, the original chart is saved in memory to allow the Reset Defaults option. If you don't want to provide such option to the end-user, you may avoid the process of saving the chart in memory. This can be accomplished by turning off the EnableRestore flag (enabled by default). You must use the bitwise combination of the flags and property, as follows:


chart1.setPersonalizedFlags(ENABLE_RESTORE);

In order to prevent other interference among Personalized Chart settings saved from different applications or web sites, all changes made by the user will be saved in the directory pointed by the Isolated Storage assigned by .NET to the application. .NET automatically assigns a unique name to every application that uses Isolated Storage. This way, your charts will not interfere with other applications or web sites that also use Chart FX for .NET as their preferred charting engine. And getting back to the original state of your applications or web site translates into removing some files from the Isolated Storage directory.

For more information regarding the PersonalizedFlags enumeration refer to the Chart FX for Java API Reference.