The most common attributes include
ChartAreas: adds multiple drawing areas. Each drawing area contains independent chart groups and data sources. It is used when multiple chart types are incompatible in one drawing area.
AlignmentOrientation: AlignmentOrientation defines the alignment between two drawing areas.
AlignmentStyle: alignentstyle is an alignment type that defines the elements used between charts.
AlignWithChartArea: Specifies the name of the AlignWithChartArea.
InnerPlotPosition: The position attribute of the chart in the drawing area.
Auto: whether to automatically align.
Height: the Height of the chart in the drawing area (percentage, value range: 0-100)
Width: the Width of the chart in the drawing area. The value ranges from 0 to 100)
X, Y: coordinates of the chart in the upper left corner of the drawing Area
Position: The Position attribute of the drawing area, which is the same as InnerPlotPosition.
Name: Name of the drawing area.
Axis: Coordinate Axis set
Title: Axis Title
TitleAlignment: Axis title alignment
Interval
IntervalOffset: the offset of the Axis scale.
MinorGrid: Secondary guides
MinorTickMark: secondary dial
MajorGrid: main guides
MajorTickMark: Main dial
Performanceid: the data source of MSChart.
Legends: a legend.
Palette: Specifies the chart appearance.
Series: the most important attribute. A chart set is the final set of pie charts, bar charts, line charts, and point charts. Multiple compatible types can be placed in one drawing area, form a composite graph.
IsValueShownAsLabel: whether to display the data point label. If it is true, each data value is displayed in the chart.
LabelFormat: data point label text format
LabelAngle: label font Angle
Name: Chart Name
Points: data point set
XValueType: X axis type
YValueType: Y axis type
XValueMember: the data source bound to the X coordinate. (If the data source is Table, enter the name of the field to be displayed)
YValueMembers: the data source bound to the Y coordinate. (If the data source is Table, enter the name of the field to be displayed. The Y coordinate can have two values)
ChartArea: name of the drawing area to which the chart belongs
ChartType: Chart type (such as column, pie, line, and point)
Legend: name of the Legend used by the chart
Titles: Title set.
Width: the width of MSChart.
Height: the height of MSChart.
Common events:
Series1.Points. DataBind ()
Bind a data point set. If you want to add charts of different data sources to a chart area (ChartArea) of an MSChart control, use this method to bind the data point set. You can bind the values of specified fields in the table to the specified coordinate axis.
MSChart1.DataBind ()
Bind a data source to the entire MSChart. All charts in this MSChart can use this data source as the statistical source.
Example:
Private void BindGrid ()
{
Chart2.Width = 800;
Chart2.Height = 600;
// Set the display attribute of the graphic Area
// Chart2.ChartAreas ["ChartArea1"]. AxisX. IsMarginVisible = false;
// Chart2.ChartAreas ["ChartArea1"]. Area3DStyle. Enable3D = false;
// Set the background color
Chart2.ChartAreas ["ChartArea1"]. ShadowColor = Color. Transparent;
Chart2.ChartAreas ["ChartArea1"]. BackColor = Color. FromArgb (209,237,254); // This field is set to gradually change from blue to white.
Chart2.ChartAreas ["ChartArea1"]. BackGradientStyle = GradientStyle. TopBottom;
Chart2.ChartAreas ["ChartArea1"]. BackSecondaryColor = Color. White;
// X, Y coordinate line color and size
Chart2.ChartAreas ["ChartArea1"]. AxisX. LineColor = Color. FromArgb (64, 64, 64, 64 );
Chart2.ChartAreas ["ChartArea1"]. AxisY. LineColor = Color. FromArgb (64, 64, 64, 64 );
Chart2.ChartAreas ["ChartArea1"]. AxisX. LineWidth = 2;
Chart2.ChartAreas ["ChartArea1"]. AxisY. LineWidth = 2;
Chart2.ChartAreas ["ChartArea1"]. AxisX. Title = "time ";
Chart2.ChartAreas ["ChartArea1"]. AxisY. Title = "gray ";
// Set the color of the X and Y lines in the middle
Chart2.ChartAreas ["ChartArea1"]. AxisX. MajorGrid. LineColor = Color. FromArgb (64, 64, 64, 64 );
Chart2.ChartAreas ["ChartArea1"]. AxisY. MajorGrid. LineColor = Color. FromArgb (64, 64, 64, 64 );
// X.Y axis data display Interval
Chart2.ChartAreas ["ChartArea1"]. AxisX. Interval = 1.0;// Display interval of X axis data
Chart2.ChartAreas ["ChartArea1"]. AxisX. IntervalType = DateTimeIntervalType. Days;
Chart2.ChartAreas ["ChartArea1"]. AxisX. IntervalOffset = 0.0;
Chart2.ChartAreas ["ChartArea1"]. AxisX. IntervalOffsetType = DateTimeIntervalType. Days;
Chart2.ChartAreas ["ChartArea1"]. AxisX. LabelStyle. Format = "M-d ";
Chart2.ChartAreas ["ChartArea1"]. AxisY. Interval = 200 ;//Y axis data display Interval
// Display interval of lines on the X axis
// Chart2.ChartAreas ["ChartArea1"]. AxisX. MajorGrid. IntervalType = DateTimeIntervalType. Hours;
Chart2.Palette = ChartColorPalette. Pastel;
String SQL = "select sum (zhl) zhl, input_date, ash_type_name from (" +
"Select sum (t. second_load-t. first_load) as zhl," +
"To_date (to_char (t. input_date, dd/mm/yyyy) | 00:00, dd/mm/yyyy hh24: mi: ss) as input_date," +
"U. ash_type_name" +
"From transportation_bill t, ash_type u" +
"Where t. ash_type_id = u. ash_type_id" +
"And (t. input_date between to_date (2009-6-11, yyyy-mm-dd) and to_date (2009-6-20, yyyy-mm-dd)" + // conditions for query by date are added here
"And t. sale_organization_id = 1" + // query by the user's organization