ChartControl第一课简短的控件初步设计

WinForms Controls >Controls > Chart Control > Getting Started

This document gives you a quick overview of what resources you need to review first to get started with the XtraCharts Suite. These examples demonstrate the basic functionality of XtraCharts, and provide you with the step-by-step instructions on how to create simple and advanced charting applications in MS Visual Studio.

For basic information on how to use the XtraCharts Suite, please refer to the Fundamentals section.

Step-by-Step Tutorials

To quickly get started with XtraCharts, we suggest that you review the following tutorials.

Online Videos

In addition to the lessons listed above, we have prepared a lot of online videos to help you become familiar with XtraCharts. They will be of particular interest to those developers who recently started working with Visual Studio .NET, or have not yet had an opportunity to see XtraCharts in action. In general, these online demos show how to replicate the steps that are described in the corresponding lessons, and also demonstrate some additional features.

XtraCharts online videos are available on the DevExpress Channel website.

See Also

Charting Basics

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

第一课 使用向导创建图表(Chart)

教程介绍图表向导,将允许你和最终用户从无到有的创建并定制任何复杂程度的图表。本例中,使用向导创建简单的自由图表。然而,注意,如果你定义了图表的ChartControl.DataSource属性,向导可以提供一系列数据相关的设置,这样你就可以完成一些非常复杂的数据绑定操作。

默认情况下,每次将ChartControl控件从工具栏拖到窗口上时,Chart向导自动被激活(如果“每次添加新图表时都显示向导”选项在向导的状态栏可用)。单击智能标签可以快速启动向导,在action列表中选择Run Wizard(运行向导)命令。

Lesson1

Lesson 1 - Create a Chart using the Wizard

WinForms Controls >Controls > Chart Control > Getting Started > Lesson 1 - Create a Chart using the Wizard

This tutorial introduces the Chart Wizard, which allows you and your end-users to create and customize a chart of any level of complexity from scratch. In this example, we‘ll use the Wizard to create a simple unbound chart. However, note that if your chart‘sChartControl.DataSource is defined, the Wizard also provides a complete set of data-related settings, so that you can use it to perform even the most complex data binding tasks.

By default, the Wizard is automatically invoked each time a ChartControl is dropped from the toolbox, (if the "Display a wizard every time a new chart is added" option on the Wizard‘s status bar is enabled). And, you can quickly run the Wizard for your chart, by clicking its smart tag, and from its actions list, choosing the Run Wizard... command.

Then, proceed with the Wizard‘s steps, to construct the chart.

根据向导进行操作,完成图表的构建。

  • On the first Chart Type page, choose the Bar chart type. The type specified at this step is not absolute, and you will have the option to change it in anotherSeries page, because the chart type (thediagram type) is determined by the view type of the series it displays.
  • 第一页是Chart Type(图表类型)页,选择Bar chart(长条图)。本教程中向导选择的图表类型是特定的,你自己开发时可以选择任意一种图表类型,也可以随时更改图表的类型。

  • Switch to the next Appearance page. Here, you can choose the look-and-feel for your chart by specifying itspalette and choosing its specificstyle. For details on this, refer toAppearance Customization.
  • 翻看接下来的Appearance(外观)页。你可以为图表选择特定外观,方法是设定Palette(调色板)并选择Style(样式)。
  • The next Series page is where you actually determine the type of your chart. It depends on which view type has the first visible series in the chart‘s collection. And, in order to combine multiple series of different types within the same chart, their view types must be compatible. For details on this, refer to Combining Different Series Views.
  • Series(序列)页面是你真正设计你的图表类型的地方。它取决于在图表集合中哪一种View type(视图类型)有第一个可见series(序列)。为了对一个图表综合使用多种系列不同类型,他们的视图类型必须兼容。 译者注:序列就是一组数字。
  • On this page, after you have created a series of the required types, ensure that theirvalue scale types are defined appropriately. Because declaring an accurate scale type series points‘values is crucial for getting the correct output. The argument scale types are defined automatically, by default.
  • 创建需要类型的序列后,确保他们的值类型正确定义了。因为要想得到正确的结果,要求点集序列必须准确的值类型。自变量的值类型会自动设为默认值。

    To learn about other options available on this tab, refer to The Wizard‘s Structure: The Construction Page Group.

  • The next Data page provides options for populating the series with points. This can be either donemanually (by specifyingarguments and theirvalues for each point) or - if your chart‘sdata source is defined -automatically (by specifying the data bindings for your series). For details on this, refer toProviding Data.
  • 数据页提供点序列生成的设置。点序列既可以手动设置(通过为每一个点设置Argument(自变量)和Value(因变量)),也可以通过定义图表的data source数据源属性自动设置(通过绑定序列定义数据)
  • At this step, the chart‘s construction is finished, so you can click Finish to see the result.
  • 图表构建完成,单击Finish查看结果。

The pages in the next Presentation group allow you to adjust the appearance of the chart and its elements, and are detailed in the following document:The Wizard‘s Structure: The Presentation Page Group.

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

Lesson 2 - Create a Simple Unbound Chart

第二课 创建简单图表

WinForms Controls >Controls > Chart Control > Getting Started > Lesson 2 - Create a Simple Unbound Chart

This example demonstrates how to construct a chart at design time within Visual Studio with manually created and populated series.

To create a simple unbound chart, do the following.

本例演示如何使用Visual Studio在设计时构建图表,并通过手动方式创建和构造数据。

Create a Chart and Add Series to it 创建图表并添加序列

  1. Start MS Visual Studio (2010 or 2012), and create a new Windows Forms Application or open an existing one.                                                                                            启动MS Visual Studio,创建窗口应用程序或者打开一个已经存在的项目
  2. From the DX.13.1: Data & Analytics toolbox tab, drop the ChartControl onto the form.
  3. 从DX:Data&Analysis工具栏页拖动ChartControl到窗口上。(我自己用的是10.2)

    Note that after you drop the Chart, the Chart Wizard may be invoked (if its "Display a wizard every time a new chart is added" option is enabled). In this example, we don‘t need to use the Wizard, so clickCancel to close its window.本例不需要向导,选择Cancel关闭向导窗口。

    Note

    For the chart to occupy all of the available space on the form, click the chart‘s smart tag, and in its actions list, clickDock in Parent Container.

    要想让图表占据窗口的所有可用空间,单击智能标签,在动作列表中单击Dock in Parent Container(在父容器中停靠)。(下图为译者所加)

  4. To add a new series to the chart, click the chart‘s smart tag, and in its actions list, click theSeries...link.                                                                                                       单击图表的智能标签动作列表中的Series...链接给图表添加新的序列                                                                                     Then, in the invoked Series Collection Editor, clickAdd....                                                                                                                                                                                                                                                                                                   在激活的序列集合编辑器Series Collection Editor中,单击Add...  。

  5. In the Series View Types dialog, specify the view type of the series being created.

    Note that the view type of the first visible series in the chart‘s collection determines itsdiagram type.

    For example, choose the Bar series, for the chart to get the XY-type.                                                                                                                                                                           在Series View Type序列类型对话框中,指定将要创建的序列的视图类型 。                                                                                                                                                              注意图表集合中第一列可见序列的视图类型决定了最终的图类型。

  6. Note

    The available view types are listed in 2D Chart Types and 3D Chart Types.

    XtraCharts automatically detects the data type of series arguments. This means that you don‘t need to specify theSeriesBase.ArgumentScaleType property before providing data for a chart, because it is set toAuto by default. Just make sure the default value of the SeriesBase.ValueScaleType property meets your requirements for some view types. Otherwise, select another value scale type (e.g., for theBar series view).

  7. XtraCharts 自动确定序列的自变量的数据类型。也就是说在给图表提供数据之前不需要指定SeriesBase .ArgumentScaleType属性,因为默认被设置为Auto。只要保证默认的value参变量SeriesBase.ValueScaleType属性满足你的视图类型需要就行,否则选择另外一种值类型。
  8. You can perform this in the Properties tab of the dialog.在Properties属性页进行操作

  9. To manually add points to your series, switch back to the Points tab. Although, some series view types may require more than one value for each point‘s argument (e.g., inBubble or Stock series), it‘s more typical for a point to have only an argument and value pair, which correspond to the point‘s X and Y coordinates along the appropriateaxes.

  10. In your chart, you can create as many different series as required. Moreover, you can combine series of different view types within the same chart,if these view types are compatible. For example, add a Spline series.
  11. 你可以创建任意数量的序列,而且可以在同一个Chart上综合不同的视图类型,只要这些视图相容,如添加一个Spline样条曲线序列。

To apply the changes and quit the dialog, click Close. Now, your chart has two different series, populated with points. It now looks like in the following image.

应用设置并退出对话框,单击Close。现在图表上有两种不同类型的序列。

Customize the Chart

  1. Customize the Legend定制图例

    By default, the chart‘s legend is shown in the top-right corner of the chart. To change the legend position, expand theChartControl.Legendproperty, and set its Legend.AlignmentHorizontal property to CenterLegend.AlignmentVertical to TopOutside, and Legend.Direction toLeftToRight.                                                             默认图例在 右 上角,要改变位置,展开ChartControl.Legend属性,并设置Legend.AlignmentHorizontal属性为Center中心,Legend.AlignmentVertical为TopOutside,Legend.Direction 为LeftToRight

  2. Add a Constant Line添加横线

    To highlight a value across any axis, a Constant Line can be drawn through it. To do this, expand the ChartControl.Diagram property, and then its IXYDiagram2D.AxisY property in the Properties window. And click the ellipsis button for itsAxis2D.ConstantLines property.

    Then, in the Constant Line Collection Editor, click Add to create a constant line, specify itsConstantLine.AxisValue property, and adjust its remaining options.                                                                                                                                                                                                                                                                                     在横线编辑器中,单击Add添加创建横线,指定横线的ConstantLine.AxisValue属性,调整到合适选项。

  3. The result is illustrated in the following image.

  4. Display Series in Different Panes在不同面板展示

    You can show each series (or group of series) in a separate pane. To do this, select the Spline series on a diagram. Then, In the Properties grid, expand the SeriesBase.View property and invoke the drop-down menu for the XYDiagramSeriesViewBase.Pane property, and click New pane.

    The result is illustrated in the following image.

    In addition, you can adjust the axes visibility in the panes, and create secondary axes as well.

  5. Customize the Crosshair Cursor定制十字准线光标

    By default, a crosshair cursor is automatically displayed on a chart control at runtime. You can enable (disable) the crosshair cursor both at the level of a chart control using theChartControl.CrosshairEnabled property, and at the level of a chart series via theSeriesBase.CrosshairEnabledproperty.

    To demonstrate the second approach, let‘s disable a crosshair label for the Bar series.

    To do this, invoke the Series Collection Editor via the chart‘s smart tag. Then, locate theSeriesBase.CrosshairEnabled property in the Series1‘s Properties tab and set it tofalse.

    Note that you can also get access to this property via the Properties grid.

    Run the application and make sure a crosshair label appears only for the Spline series.

    Let‘s show crosshair axis lines and crosshair axis labels on a chart.

    To accomplish this, locate the CrosshairOptions object in the Properties grid and set its CrosshairOptions.ShowArgumentLine,CrosshairOptions.ShowValueLineCrosshairOptions.ShowArgumentLabelsCrosshairOptions.ShowValueLabels properties to true as shown below:

    Run the application to see the result.

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

Lesson 3 - Bind Chart Series to Data

第三课 绑定数据到图表序列

WinForms Controls >Controls > Chart Control > Getting Started > Lesson 3 - Bind Chart Series to Data

This tutorial demonstrates how to bind a chart to an external data source, manually add a series to the chart, and adjust its data bindings. This means that it is possible to provide an individual data source for each series.

指南演示了如何绑定图表到外部数据源,手动添加序列到图表并调整数据绑定。也就是说,可以为每种序列提供独立的数据源。

To learn how to manually bind a chart‘s series to data, do the following.

手动绑定图表的序列到数据,按如下步骤进行

Create a Chart and Bind it to Data创建图表并绑定到数据

  1. Start MS Visual Studio (2010 or 2012) and create a new Windows Forms Application or open an existing one.启动VS新建Windows 窗体应用程序或打开已经存在的程序。
  2. From the DX.13.1: Data & Analytics toolbox tab, drop the ChartControl onto the form.拖动ChartControl到窗体
  3. In this instance, the Chart Wizard may be invoked (if its "Display a wizard every time a new chart is added" option is enabled). In this example, we don‘t need to use the wizard, so click theCancel button to close the Wizard and manually customize the chart.本实例中,Chart 向导或许被激活,这里不需要,所以单击Cancel取消关闭向导,并手动定制图表。

  4. Note

    For the chart to occupy all the available space on the form, click the chart‘s smart tag, and in its actions list, clickDock in Parent Container

    要使图表占据窗体的可用空白空间,单击Chart的智能标签,在行为列表中单击Dock in Parent Container.

  5. To define a data source for the chart, click its smart tag, and in its actions list, expand theChoose Data Source drop-down list and click on Add Project Data Source... link.            要添加图表的数据源,单击智能标签,行为列表下展开Choose Data Source选择数据源下拉列表,单击Add Project Data Source。。。添加项目数据源链接
  6. The Data Source Configuration Wizard appears. It allows you to select a data source.出现数据源配置向导,可以选择一个数据源。

  7. In the Wizard‘s first page, select the Database icon and click Next.选择数据库图标,单击Next进入下一步。

  8. In the Choose a Database Model page, click Next.在选择数据库模型页,单击Next进入下一步。

  9. On the following page, click New Connection... and specify the following path to the Northwind database file - C:\Users\Public\Documents\DXperience 13.1 Demos\Data\nwind.mdb (leave thePassword option blank). 单击New Connection...新建连接。。。并指定Northwind数据库文件目录C:\Users\Public\Documents\DXperience 13.1 Demos\Data\nwind.mdb,Password选项置空。

    To proceed, click Next.继续点击Next。

  10. Then, the following message appears.

    是否拷贝数据库文件到当前工程兵修改连接。

  11. Note

    You can choose between adding the file to your project or leaving it in its original location. For more information on Visual Studio behavior, see the "How to: Manage Local Data Files in Your Project" article in MSDN.

    Select No, as this example is not intended to change database data.选择不拷贝。

  12. Click Next on the following page to save the created connection string to the configuration file.单击Next保存创建的连接字符串到配置文件。

  13. Select the "Products" table as shown below and click Finish.选择Products表,然后单击Finish完成。

As a result, Visual Studio will generate a set of classes for data manipulation within the project. The main ones are:

VS会自动在项目中生成一些数据控制类,主要的有

  • nwindDataSet - represents a System.Data.DataSet object (a collection of tables, relationships, and constraints), which contains the Products table from the Northwind database.
  • nwindDataSet 表示一个System.Data.DataSet 对象(表、关系、约束的集合),包含了北风数据库的products 表
  • productsTableAdapter - represents a TableAdapter object that provides communication between the application and a database. Its methods are used for executing queries and stored procedures, fetching data and filling DataTables in DataSets, and sending data back to the database. It is assigned to the ChartControl.DataAdapter property.
  • productTableAdapter表示一个TableAdapter对象,这个对象支持应用程序和数据库通信。它的方法用来执行查询和存储过程,获取数据并填充DataSets里的DataTables,并返回数据到数据库,被关联到ChartControl.DataAdapter属性
  • productsBindingSource - represents a System.Windows.Forms.BindingSource component, used to simplify the data binding of the nwindDataSet to the ChartControl. It is assigned to theChartControl.DataSource property.
  • productsBindingSource 表示一个System.Windows.Forms.BindingSource组件,用来简化数据绑定到nwindDataSet到ChartControl。被关联到ChartControl.DataSource属性

Now, the chart has been bound to data. The next steps specify which data fields should be used to provide data for the chart‘s series.

现在,图表已经被绑定了数据。下一步指定哪些数据域应该被使用来提供图表的序列。

Specify a Series Data Source指定序列的数据源

  1. Now, let‘s add series to the chart. To do this, click the chart‘s smart tag and in its actions list, choose theSeries... link.给图表添加序列。单击智能标记,动作列表中选择Series...添加序列集到图表。单击图表的智能标签,行为列表选择Series序列...链接

  2. In the invoked Series Collection Editor, click Add..., and select theBar view.序列集合编辑器中点击Add。。添加选择Bar 视图。激活的序列集合编辑器中单击添加 。。,选择条形图视图。

    Note

    After you create a series, the chart displays fake data to give you an idea of what the chart will look like after genuine data is provided.

  3. Now switch to the Properties tab on the right of the editor‘s window and make the following assignments for the Series1 properties:现在转换到编辑窗口右侧的属性页,为序列1属性关联下面两个。

    - set the SeriesBase.ArgumentDataMember property to the ProductName data field; 自变量为ProductName产品名称

    - and the only value of the SeriesBase.ValueDataMembers property to UnitPrice.因变量为UnitPrice单价

    Note

    In most scenarios, it is unnecessary to specify the Series.DataSource property.大多数情况下,需指定Series.DataSource 属性

  4. To limit the number of data points in the series, click the ellipsis button for theSeriesBase.DataFilters property.为了限制序列中的点数,单击SeriesBase.DataFilters属性的省略号按钮

    In the invoked Data Filter Collection Editor, click Add, and for the created filtering criterion, set itsDataFilter.ColumnName to CategoryID andDataFilter.Value to 4. And leave the DataFilter.Condition property set to its default value (Equal).在弹出的数据过滤集合编辑器中,单击Add添加。为了创建过滤标准,设置DataFilter.ColumnName为CategoryID ,DataFilter.Value为4,DataFilter.Condition保留默认值(Equal)相等。

Populate with Data at Design and Runtime设计和运行时填充数据

  1. If you wish to see how the resulting chart will finally look at design time, click its smart tag, and in its actions list, clickPopulate. This will redraw the chart using obtained data.如果想预览设计时图表的最终外观,单击智能标签,在动作列表中单击填充,将使用获得的数据重绘图表。

    At runtime, Visual Studio automatically adds the following code to the form‘s Load event, and normally you don‘t need to add it manually.运行时,VS自动添加如下代码到窗体的Load载入事件,通常不需要手动添加。

  2. C#
    private void Form1_Load(object sender, EventArgs e) {
        // TODO: This line of code loads data into the ‘nwindDataSet.Products‘ table. 
        // You can move, or remove it, as needed. 
        this.productsTableAdapter.Fill(this.nwindDataSet.Products);
    }
    
    VB
     

Customize the Chart定制图表

  1. Now you can adjust the following options.调整如下选项

    Adjust the series-view-specific options.调整series
    For the created series, it is possible to color each Bar individually. To achieve this, select the series and in theProperties grid, expand itsSeriesBase.View property. Among the set of the view-type-specific options, locate and enable theSeriesViewColorEachSupportBase.ColorEachproperty.对创建的序列,可能需要独立指定每一个条状图的颜色。为获得这种效果,选择序列集,在属性格网张展开SeriesBase.View属性。定位到SeriesViewColorEachSupportBase.ColorEach属性。

    Then, for the series, expand its SeriesBase.LegendPointOptions property, and set the PointOptions.PointView to ArgumentAndValues.对每一序列集,展开SeriesBase.LegendPointOptions属性,设置PointOptions.PointView to ArgumentAndValues自变量因变量(参数函数值)

    Adjust the legend.
    Now, each data point is represented in the chart‘s legend by a separate item, displaying a pair of point arguments and their values. To better position the legend, select it, and in theProperties grid, set its Legend.Direction to LeftToRightLegend.AlignmentHorizontal to Center, andLegend.AlignmentVertical to BottomOutside.

    Add a chart title.
    To create a title for your chart, select it, and in the Properties grid, click the ellipsis button for theChartControl.Titles property. Then, in the invoked collection editor click Add, and for the created title, set its Title.Text and other options.

    Adjust the series point labels.
    To show the series labels, enable the SeriesBase.LabelsVisibility property.

    Adjust the crosshair cursor options.
    By default, crosshair cursor labels are displayed on a chart. You can disable (enable) a crosshair cursor both at the level of a chart via theChartControl.CrosshairEnabled property and at the level of a chart series using theSeriesBase.CrosshairEnabled property.
    To show crosshair cursor axis lines and crosshair cursor value labels, set the CrosshairOptions.ShowArgumentLine,CrosshairOptions.ShowValueLine and CrosshairOptions.ShowValueLabels properties to true.

Get the Result

The result is illustrated in the following image.

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

Lesson 4 - Use the Series Template for Auto-Created Series

第4课 使用序列模板自动创建序列

WinForms Controls >Controls > Chart Control > Getting Started > Lesson 4 - Use the Series Template for Auto-Created Series

This tutorial demonstrates how to create a chart bound to data, so that all series are auto-created based on a commontemplate, which specifies universal options for all series. This is possible when the data for all series (their names, along with points‘ arguments and values) is stored in the samedata table.

Note that in this scenario, the view type and certain other settings will be the same for all series.

In this example, we‘ll bind a chart to the "GSP" table in the GSP database (the gsp.mdb file is shipped with the installation of the XtraCharts Suite). This table contains the Gross State Product (GSP) statistics for certain US regions.

To bind a chart to data using series templates, do the following.

Create Data Objects and Bind a ChartControl

  1. Start MS Visual Studio (2010 or 2012) and create a new Windows Forms Application or open an existing one.
  2. Drop the ChartControl onto the form.

    Note that after you drop the chart control, the Chart Wizard may be invoked (if its "Display a wizard every time a new chart is added" option is enabled). In this example, we don‘t need to use the Wizard, so clickCancel to close its window.

  3. For the chart to occupy all the available space on the form, click the chart‘s smart tag, and in its actions list, clickDock in Parent Container.
  4. To create a data source for a chart, select it and click its smart tag. In the invoked actions list, expand theChoose Data Source drop-down selector and click the Add Project Data Source... link.

    Then proceed through the following steps suggested by the invoked Data Source Configuration Wizard.

  5. In the first step, choose the Database icon and click Next.

  6. In the Choose a Database Model page, click Next.

  7. On the following page, click New Connection... and specify the following path to the GSP database file - C:\Users\Public\Documents\DXperience 13.1 Demos\Data\gsp.mdb (leave thePassword option blank).

    Click Next to proceed.

  8. Then, the following message appears.

    Note

    You can choose between adding the file to your project or leaving it in its original location. For more information on Visual Studio behavior, see the "How to: Manage Local Data Files in Your Project" article in MSDN.

    Select No, as this example is not intended to change database data.

  9. On the following page, you are asked whether or not the created connection string should be saved to the configuration file of your project.

    Leave the default setting and click Next.

  10. The final page allows you to choose tables, which should be obtained from the database.

    Select the "GSP" table and click Finish.

After performing the above steps, Visual Studio generates a set of classes that support ADO.NET architecture, some of which are then auto-assigned to the appropriate properties of your chart control. In particular:

gspDataSet (a System.Data.DataSet object that is a collection of possibly inter-related tables) containing thegspDataTable;

gSPBindingSource (a System.Windows.Forms.BindingSource component, which provides data in the chart‘s dataset) is auto-assigned to theChartControl.DataSource property;

gSPTableAdapter (TableAdapter object, which contains methods to get and post data from the specified table in the database) is auto-assigned to theChartControl.DataAdapter property;

This means that the chart has been successfully bound to the data source. The next steps explain how to assign its data fields to the chart‘s series template.

Specify a Series Data Member and Adjust a Series Template

  1. Now, let‘s specify a data field for as many series to be auto-created as there are records in this field. To do this, set theChartControl.SeriesDataMember property to Year.

    Note that series names (as they will appear in the Legend) will correspond to this field‘s values.

  2. Now, adjust the series‘ template, which is accessed via the chart‘s ChartControl.SeriesTemplate property.

    In particular, you are required to define data fields where series obtain information for their pointarguments and values.

    To accomplish this, set the SeriesBase.ArgumentDataMember property to Region.

    Then set the only value of the SeriesBase.ValueDataMembers property to GSP.

    Note that some series view types may require more than one value for each argument (such as Stock or Bubble series). In such cases, multiple data members should be specified for theSeriesBase.ValueDataMembers collection.

Now, the chart possesses complete information about the data source and its data members. However, it still doesn‘t show the real data at design time. To populate your chart with genuine data, click the chart‘s smart tag and clickPopulate.

Populate with Data at Runtime (Optional)

MS Visual Studio automatically adds the following code to the form‘s Load event, and normally you don‘t need to add it manually.

  1. To populate a DataTable object with data from the database, the correspondingTableAdapter‘s Fill method can be used. In this example, the chart‘sDataTable is populated with data using the Fill method of thegSPTableAdapter object. The form‘s Load event is used to handle data loading.

    C#   VB  

    private void Form1_Load(object sender, EventArgs e) {
        // TODO: This line of code loads data into the ‘gspDataSet.GSP‘ table.  
        // You can move or remove it as needed. 
        this.gSPTableAdapter.Fill(this.gspDataSet.GSP);
    }
    
    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
        ‘ TODO: This line of code loads data into the ‘gspDataSet.GSP‘ table.  
        ‘ You can move or remove it as needed. 
        Me.gSPTableAdapter.Fill(Me.gspDataSet.GSP)
    End Sub 
    

    C#
    private void Form1_Load(object sender, EventArgs e) {
        // TODO: This line of code loads data into the ‘gspDataSet.GSP‘ table.  
        // You can move or remove it as needed. 
        this.gSPTableAdapter.Fill(this.gspDataSet.GSP);
    }
    
    VB
    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
        ‘ TODO: This line of code loads data into the ‘gspDataSet.GSP‘ table.  
        ‘ You can move or remove it as needed. 
        Me.gSPTableAdapter.Fill(Me.gspDataSet.GSP)
    End Sub 
    

Customize the Chart

Finally, you can specify optional properties, which will be applied to all the auto-created series.

  1. Adjust the series name template.

    By default, the name for every auto-created series (as it appears in the Legend) is obtained from an appropriate data field. However, you may wish to add some prefixes or postfixes to these names, which can be done via theSeriesNameTemplate.BeginText andSeriesNameTemplate.EndText properties. For this instance, set the SeriesNameTemplate.BeginText property to "GSP in ".

  2. Adjust the crosshair cursor options.
    By default, crosshair cursor labels are displayed on a chart. You can disable (enable) a crosshair cursor both at the level of a chart via theChartControl.CrosshairEnabled property and at the level of a chart series, using theSeriesBase.CrosshairEnabled property.
    To show crosshair cursor axis lines, set the CrosshairOptions.ShowArgumentLine and CrosshairOptions.ShowValueLine properties to true.

Get the Result

Run the project and view the result.

时间: 2024-10-16 06:53:25

ChartControl第一课简短的控件初步设计的相关文章

【Android开发学习笔记】【第四课】基础控件的学习

通过一个简单的例子来学习下面几种控件: 1.TextView:简单的文本显示控件 2.EditText:可以编辑的文本框 3.Button:按钮 4.Menu:这里指的是系统的Menu 5.Toast:消息提示控件,类似于MFc的tip(不知道理解的对不对) 顺便用到上一次学习的多个Activity之间传递数据的技术,来做一个小的计算乘法的case 步骤: (1)主Activity 和显示结果的 Activity 都采用线性布局,下面是布局文件的源代码: <LinearLayout xmlns:

Vs自定义控件设计第一例(直线控件的设计)

目录 一. 杨老师是个热情的人 二. 开始喽 三. 还需要些解释什么吗 四. OK了吗 五.最终代码 一.杨老师是个热情的人 我们的项目开源有一段时间了,我一直以为我有一个很不错的胸怀把自己花了很多精力做出来的项目贡献出来了,我以为同学们会很开心,会像“一个饥饿的人看到面包”一样的扑到了我的项目代码上面快乐的研究起来,但是事实上我们的群里面却异常的冷清.我想应该是大家都还在研究代码来不及说话或者是不爱说话吧,直到今天杨老师给我打电话,说了一些情况,似乎是说大家还不太懂数据库等等,我才知道是我错了

第七课-基本控件

我们打开res文件夹,layout目录中的布局文件,显示如下: 右边就是显示的预览效果: 左边的栏就是所有的控件,我们可以任意的往布局中拖入控件,观察效果. 我们初期就了解3个控件: TextView--显示文本信息. EditText--可以让用户输入. Button--可以响应用户的点击.

Spring.Net.Framework快速开发平台之第一章SNF-MVC通用控件库展示-绝对让你眼前一亮

在我们开发中怎么才能提高效率,就是要有大量的公共组件(控件)可以直接使用而不用自己再开发一遍,既然是公共控件那也得简单实用才行.下面就介绍一下SNF-MVC当中的控件库. 总体控件库展示: 1.通用用户选择(单选.多选) 2. 通用组织机构选择 3. 通用角色选择 4. 通用弹出选择窗口 a) 弹出列表(单选.多选) b) 弹出树(单选.多选) 5. 通用下拉选择 a) 下列选择(单选.多选) b) 下列选择树(单选.多选) 6. 几个通用表单控件 a) 金额.数字 b) 日期.日期范围 c)

chartcontrol(统计坐标图形控件)

统计图形 把控件拖放到界面会弹出下图 图形共分八系列:Bar Series,Point and line Series,pie Series,Funnel Series,Area  Series,Range Series,Radar and polar Series,Advanced  Series Bar Series  棒系列 Point and line Series 点和线系列 pie Series 饼系列 Funnel Series 漏洞系列 Area  Series  域系列 Ran

CAS——手写第一步:HTML控件与Web服务器控件

ITOO的CAS我负责带领研究了一段时间,貌似退出做出来了,但是它一直是病态的,俗话说,有病就得治,治不了想办法也得治,原路一直是在找我们错在了哪里,为什么不能实现的怪圈里.其实我们可以跳出这个怪圈,用另外一种方法去解决这个问题. 既然当前的CAS用不了,SSO退出实现不了,那我们就自己用单点登录的逻辑自己写一套CAS.写的过程中,大屈是主导君,我是管理君.后来交给我一个小任务,就是把服务器控件改成HTML客户端控件.当时不造为什么,现在来研究一下这两种控件有什么区别. 这要追溯到Asp.net

第三章 控件(6~7课)

第6课:创建和使用控件 第7课:常用控件 概述: 在MFC中,控件是具有独立功能的人机交互的小窗口,它们除了可以使用自身成员外,还可使用其基类CWnd类的公有成员,因为几乎所有的控件类都是从CWnd类派生而来的. 正因为如此,当用控件类的Create创建控件时,除了自身的样式预定义标识外,还有窗口通用的样式预定义标识. 当对话框资源创建对话框类后,控件只能以成员的方式出现在对话框类中. 控件变量: 用MFC ClassWizard可为控件在对话框类中创建两种类别的成员变量:其一是控制类,即创建的

C#控件方法及属性大全,望补充

C#控件及常用设计整理 1.窗体 常用属性 (1)Name属性:用来获取或设置窗体的名称,在应用程序中可通过Name属性来引用窗体. (2) WindowState属性: 用来获取或设置窗体的窗口状态. 取值有三种: Normal (窗体正常显示). Minimized (窗体以最小化形式显示)和 Maximized(窗体以最大化形式显示). (3)StartPosition属性:用来获取或设置运行时窗体的起始位置. (4)Text属性:该属性是一个字符串属性,用来设置或返回在窗口标题栏中显示的

C#控件事件属性大全

C#控件及常用设计整 1.窗体... 1 2.Label 控件... 3 3.TextBox 控件... 4 4.RichTextBox控件... 5 5.NumericUpDown 控件... 7 6.Button 控件... 7 7.GroupBox 控件... 7 8.RadioButton控件... 8 9.CheckBox 控件... 8 10.ListBox 控件... 9 11.ComboBox 控件... 10 12.CheckedListBox 控件... 10 13.Pict