Step 1 of 4: Adding Chart to Your Project
In This Topic
In this step you'll begin in Visual Studio to create a chart application using Chart for WPF and Silverlight. When you add the C1Chart control to your Visual Studio project, you’ll have a functional column chart with fake data.
Complete these steps:
- Create a new WPF or Silverlight application in Visual Studio.
- Select File | New | Project. The New Project dialog box will open.
- In the New Project dialog box, select a language in the left-hand pane, and then select a template:
- For WPF, select Windows Desktop. Then, select WPF Application from the list of applications in the center pane.
- For Silverlight, select Silverlight. Then, select Silverlight Application from the list of applications in the center pane.
- Give your application a Name, and then select OK. Your application will open.
- Add references to your application by right-clicking the Reference folder and selecting Add Reference. The Reference Manager will open.
- Browse to locate the appropriate references for your project.
- For a WPF application, add the following reference:
- For a Silverlight application, add the following reference:
- C1.Silverlight.Chart.5.dll
- Add the following namespace declaration to your <Window> or <UserControl> tag. This will allow you to add chart data later in this project if you're working in XAML markup.
XAML |
Copy Code
|
xmlns:System="clr-namespace:System;assembly=mscorlib"
|
- Place your cursor between the <Grid> </Grid> tags within either your Window or your UserControl, depending on the type of application you're creating.
- Locate the C1Chart control in Visual Studio's ToolBox. Double-click the control to add it to your application. The XAML markup will resemble the following:
XAML |
Copy Code
|
<Grid x:Name="LayoutRoot">
<c1chart:C1Chart></c1chart:C1Chart>
</Grid>
|
- Give your chart a name so that you can call it in code later. Your markup will resemble the following sample:
XAML |
Copy Code
|
<c1chart:C1Chart Margin="0,0,8,8" MinHeight="160" MinWidth="240" Name="c1Chart1">
</c1chart:C1Chart>
|
What You've Accomplished
You've successfully created a WPF or Silverlight application containing a C1Chart control. In the next step, you will Step 2 of 4: Adding Data to the Chart, you will add the data for C1Chart.
See Also