Chart Asp:chart

Source: Internet
Author: User
Tags dashed line transparent color

Asp:chart Property

The System.Web.UI.DataVisualization.Charting namespace contains methods and properties for the chart Web server control.

Learn more about the chart class http://msdn.microsoft.com/zh-cn/library/dd467201.aspx

To use Asp:chart, perform the following 3 steps first

1, vs2008 installation mschart_visualstudioaddon.exe,vs2010 installation MSChart.exe Click to download Chart.rar

2, vs2008 after installing Mschart_visualstudioaddon.exe, there is still no chart control in the toolbox, when you want to modify the Web. config file:
①add this under the controls tag (path: "<system.web> <pages> <controls>"):

View Code

②and Add this HttpHandler (under "

View Code

3. Add Reference System.Web.DataVisualization.dll click to download System.Web.DataVisualization.rar

Let's take a look at the icons for each property

  A simple example of the following list of Asp:chart common property settings

the root class of the chart chart control

Name Type Description Desfault
Id String Gets or sets the programmatic identifier assigned to the server control.
Height Int Gets or sets the height, in pixels, of the entire chart image.

Note: cannot be expressed as%, must be a definite value

Width Int Gets or sets the width, in pixels, of the entire chart image.

Note: cannot be expressed as%, must be a definite value

BackColor String Gets or sets the base color of the background color of the Chart object.
BorderColor String Border color
BorderWidth Int

Border thickness

Borderdashstyle String Gets or sets the border style of the strip line. a line can be a solid line, a dashed line, or some variation of solid and dashed lines.
Backgradientstyle

Enum class

GradientStyle

Gets or sets the background gradient direction of the Chart control. also determines whether gradients are used.

Value: Reference GradientStyle

None
Backsecondarycolor Color

Gets or sets the secondary color of the chart background, used when the gradient color is applied, or represents the hatch color.

Value: Any valid ARGB (alpha, red, green, blue) values.

Empty
DataSource Gets or sets the data source for the Chart object.
Palette

Enum class

Chartcolorpalette

Gets or sets the color palette of the Chart control.

The palette is used to automatically assign colors to data elements when the following two conditions are met:

1, the data point itself does not have the specified color. 2. the data series to which the point belongs does not have a specified color.

None
Palettecustomcolors Color[]

Gets or sets an array of custom palette colors.

Note: If you need more than 16 colors, or if you want to apply your own color to the chart, you must define a custom palette.

Palette is set to none to work

ImageLocation String Gets or sets the location where the image file is saved when the Imagetag rendering is performed
ImageType String Gets or sets the type of image that renders the chart when using Imagetag rendering.

Note:

GradientStyle: None,leftright,topbottom,Center,diagonalleft,diagonalright,horizontalcenter, Horizontalcenter

Chartcolorpalette : < Span class= "Selflink" > none,bright,grayscale (grayscale color), excel,light,pastel (Light), earthtones,semitransparent (transparent color), berry,< Span class= "Selflink" >chocolate,fire,

Seagreen. Brightpastel

Chart child elements

Titles represent the title of the entire chart image.

Name Type Description Desfault
ForeColor Color Gets or sets the color of the caption text.
Docking

Enum class

Docking

Gets or sets a value that determines where the title is docked.
Font Font Gets or sets the font for the caption.
Text String Gets or sets the text of the caption.

Legends represents a legend for a chart image.

Name Type Description Desfault
Docking

Enum class

Docking

Gets or sets a value that determines where the legend is docked.

Working Condition: Position Property set to Auto

Right
Enabled

bool

Gets or sets a value that determines whether the legend is enabled. True
Font Font Gets or sets the font object that is used to set the legend font properties.
ForeColor Color Gets or sets the color of the legend text.
Isdockedinsidechartarea bool

Gets or sets a flag that indicates whether the legend is docked within the chart area or not.

Note: Only if the Dockedtochartarea property is set to the name of the ChartArea object, Position

property is set to the value of auto, this property is only valid

False
Istextautofit bool Gets or sets whether a flag caption text is automatically resized.
Legendstyle Legendstyle Gets or sets the legend table style. Table
Name String Gets or sets the name of the legend.

Legendstyle: Column,Row,Table

Docking : Top, right,Bottom, left

Series stores data points and sequence attributes.

Name Type Description Default
ChartType ChartType Gets or sets the chart type of the sequence.
Isvalueshownaslabel bool Gets or sets a flag that indicates whether the value of the data point is displayed on the label. False
Labelformat String Gets or sets the format of the data point label.
Name String Gets or sets the unique name of the Series object.
Points

Datapointcollection

Object

Get Datapointcollection object, (data point set)
ToolTip String Gets or sets the ToolTip for the data point.
Xvaluemember String Gets or sets the chart data source member column that is used to bind data to the X-values of the series. (field name in DataSource)
Yvaluemembers String Gets or sets the member column of the chart data source to use to bind data to the sequence Y value. (field name in DataSource)

Chartareas represents the chart area on the chart image.

Name Type Descript Default
AxisX Gets or sets the Axis object that represents the primary X axis.
AxisX2 Gets or sets the Axis object that represents the secondary X-axis.
Axisy Gets or sets the Axis object that represents the primary Y axis.
AxisY2 Gets or sets the Axis object that represents the secondary Y-axis.
Name String Gets or sets the unique name of the ChartArea object.
AxisX.MajorGrid.Enabled bool Sets whether the grid of the icon area is visible True

Borderskin A drawing property that represents the appearance of a three-dimensional border.

Name Type Description Default
Skinstyle Color Gets or sets the style of the border skin.
BorderColor Borderskinstyle Gets or sets the border color of the border skin frame. None

Borderskinstyle: None,Emboss (Sunken),raised (convex),Sunken (sunken),FrameThin1 ...

Example:

. aspx foreground code

View Code

. Aspx.cs Background Code

View Code

Final effect:

Attention:

If the Palette property of the Chart and Series objects is set to none and no color is assigned to the related data series or data points, the data points are not plotted and the data point is displayed as an empty area.

Chart Asp:chart

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.