.Net Chart Control A powerful component for convenient charting.
More
convenience more functionality in Ver. 3.5 |
|||||||
|
|
Using Chart Toolbar |
| Click here to get sample solution. |
|
Chart Toolbar allows quickly change chart type and legend location, print and save chart, reloads chart data, load and apply themes, rotate 3D charts and call chart parameters form
Toolbar appearance is configured with simple XML document, so you can change its appearance and number of the toolbar buttons in any time. With toolbar abilities to reload data and execute commands you can easy create dynamically changed chart. |
At the first we should prepare XML document with toolbar structure. The schema
of the chart toolbar XML document is easy.
<ChartToolbar DropDownImage="Art\Toolbar\Arr.png"> <Band> … </Band> <Button .../> <ButtonDropDown Image="Art\Toolbar\ChartType.png" Command="cmdPrepareDropDown" Tooltip="cmdChartType"> … </ButtonDropDown> <Separator/> </ChartToolbar> |
| <Band> element describe toolbar appearance. It has the same structure as Band type elements in the chart XML. You can find detailed description of the Band type in the user manual. |
The
<Button>
element represents single button in the toolbar. It allows execution of the
single command supported by the toolbar. This element has following structure:
<Button Image="Name of the image file will be used to show image on the button" Command="Command will be executed when button clicked" Tooltip="Name of the predefined tool tip or text will be used as a button tool tip" ChartType="Type of the chart will be shown (should be used with cmdChangeChartType command)" Legend="Legend location (should be used with cmdChangeLegend command)" Theme="Name of the file that contains chart theme (could be used with cmdLoadTheme command)." SplitType="Horizontal | Vertical – Allows create button that consist from 2 ones." Image1="Name of the image file will be used to show image on the button" Command1="Command will be executed when button clicked" Tooltip1="Name of the predefined tool tip or text will be used as a button tool tip" Param1="" Param2="" Param3=""/> |
The
<ButtonDropDown>
represents the dropdown toolbar button. Click on this button results another
panel with buttons appears on the screen. Content of this panel is given as
child elements of the
<ButtonDropDown>
element. This element has following structure:
<ButtonDropDown Image="Name of the image file will be used to show image on the button" Command="Command will be executed when button clicked. Only cmdPrepareDropDown is currently allowed for this button." Tooltip="Name of the predefined tool tip or text will be used as a button tool tip" > <Button … /> … <Button … /> </ButtonDropDown> |
| The <Separator/> allows separate one group of the toolbar buttons from another. |
Currently chart toolbar supports following commands:
<Button ...> <Layout …> … </Layout> </Button> |
| You can find sample of the chart toolbar XML file in the sample solution. |
To add toolbar to your form:
|
The code of the constructor of your form could looks like the following:
public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); Stream stream = Manco.Chart.ResourceLoader.GetFileStream("ChartToolbar.xml"); xmlToolbar = new XmlDocument(); xmlToolbar.Load(stream); stream.Close(); chartToolbar.SetStructure(xmlToolbar.DocumentElement); } |
Add code to load chart XML document and draw chart to the form’s On Load event
handler. It could looks like the following:
private XmlDocument xmlChart; private void Form1_Load(object sender, System.EventArgs e) { xmlChart = new XmlDocument(); xmlChart.Load(Path.GetDirectoryName(Application.ExecutablePath) + "\\IntroChart.xml"); chartControl.ChartDocument = xmlChart; chartToolbar.ChartDocument = xmlChart; chartControl.Draw(); } |
|
Run your application. You will see the chart and toolbar that looks as it was specified in the toolbar XML document.
Click
here to get sample solution |
| Our another product: .Net Licensing System Back to main page of .Net Chart |
|
|
| Copyright © 1994-2005 .Net Charting Software Inc. | Division of ASE | contact us | about us | clients | privacy policy | Add link | .Net resources | Free services |