The chart web part seems to just be an extension of the Microsoft .NET Chart class that allows you to specify the properties of the class via XML that is embedded in your SharePoint Web Part Page. There are wizards and an advanced interface available on the web part pages to configure this underlying XML, but there are more options available to you if you are willing to dig in and edit your page via SharePoint Designer. Using SharePoint designer I was able to overcome what seems like a simple problem, how do I use a custom color palette on my chart?
I am going to outline the steps you need to take in order to add custom colors to a chart. You can skip some of these steps and go straight to editing the XML, but I find that by completing my charts first and then editing the XML there is a lower chance of me accidentally blowing away my custom settings by going through a wizard.
- Add a chart web part to your page.
- Connect the chart to your data source using the data connection wizard.
- Start the chart customization wizard to format your chart.
- Select your chart type (type doesn't matter for custom palettes)
- On the Appearance Themes tab:
- Set the Theme to "Custom"
- Set the Transparency to "Custom"
- Finish the wizard setting any values other than the two above.
- Launch SharePoint Designer and open the source of your page.
- Search for the String "PaletteCustomColors" this will take you to the embedded XML element for the custom palette.
- The palette is ten semicolon(;) delimited values that you can set to whatever colors you want. For how to specify color values in this section see the paragraph below.
- Save your page source and refresh the page, you should now see your custom colors!
Now that you know how to define colors you can go in and set your own palette of ten colors for use on your chart! The chart web part will assign colors to your series based on when the values occur so the first series value will map to the first color and the next to the second, etc...
You must be careful when you use this editing XML method for changing charts because if you later use the wizards to edit your charts they may remove your customized values. I have found that color is pretty stable and your settings will not be deleted unless you go into the wizard and change the color palette, transparency, or chart type. But if you use this method to edit other values they may be wiped out by using the wizard.
For reference you can find the documentation for the chart class here: http://technet.microsoft.com/en-us/system.web.ui.datavisualization.charting this documentation will show you the properties that are available on the chart class and that may be usable via the editing XML method.
Good luck and happy charting!
2 comments:
Woo hoo! This worked for me! Thanks for the great information!
The first useful document I found about how to easily modify colors on a sharepoint chart webpart! Works like a charm and is uber easy to do.
Post a Comment