ComponentOne WebChart use
ComponentOne WebChart use - 4 (Bingtu)
The demonstration Bingtu production, the style of brief Bingtu effects and PlotArea object properties.
1, generated Bingtu
C1WebChart1.ChartGroups.Group0.ChartType? =? Chart2DTypeEnum.Pie;
Chart type settings. ?
?
DataSet? Ds? =? GetDataSet ();
DataView? Dv? =? New? DataView (ds.Tables [ "sanguo"]);
/ / Remove all data sequence diagrams
C1WebChart1.ChartGroups [0]. ChartData.SeriesList.Clear ();
Like here and polyline Fig.
For (int? I = 0;? I? <? Dv.Count;? I + +)
(
??????? ChartDataSeries? Series? =? C1WebChart1.ChartGroups [0]. ChartData.SeriesList.AddNewSeries ();
??????? Series.PointData.Length? =? 1;
??????? Series.Y [0]? =? Float. Parse (dv [i] [ "value"]. ToString ());
)
Adding data for the chart.
Fig here and Multiline Bingtu only difference is that the Y-axis settings coordinate value can be, all the same sequence of data indexed portfolio into a Bingtu. Here there will be data on every one of a new data series, and each sequence is only one element. In this way, all the data will show in a Bingtu. Figure:
Bingtu this is the default style is not less?
Next, on the pattern settings.
Second, the pattern design Bingtu
1)? Add Legend
C1WebChart1.Legend.Visible? =? True;
Legend set targets for the Visible attribute true, the legend will be displayed. Then Legend sequence tags for the names of the default.
For (int? I = 0;? I? <? Dv.Count;? I + +)
(
??????? ChartDataSeries? Series? =? C1WebChart1.ChartGroups [0]. ChartData.SeriesList [i];
??????? Series.Label dv = [i] [ "name"]. ToString ();
)
Legend set up the display content labels. To concise code can also add data set at the same time.
In addition, we can also use the object Legend (Legend objects) settings Legend display modes. Such as:
C1WebChart1.Legend.Compass? =? CompassEnum.West;
Legend set up the display position.
Other attributes, such as Legend Show Orientation set direction (vertical or horizontal display shown), no detail can be to try to use their own.
2)? To allow data more intuitive, can add labels Bingtu
For (int? I = 0;? I? <? Dv.Count;? I + +)
(
??????? C1.Win.C1Chart.Label? Lbl? =? C1WebChart1.ChartLabels.LabelsCollection.AddNewLabel ();
??????? Lbl.Text? =? String. Format ( "(0)%" float. Parse (dv [i] [ "value"]. ToString ()));
??????? Lbl.Compass? =? LabelCompassEnum.Radial;
??????? Lbl.Offset? =? 20;
??????? Lbl.Connected? =? True;
??????? Lbl.Visible? =? True;
??????? Lbl.AttachMethod? =? AttachMethodEnum.DataIndex;
??????? AttachMethodData? Am? =? Lbl.AttachMethodData;
??????? Am.GroupIndex? =? 0;
??????? Am.SeriesIndex? =? I;
??????? Am.PointIndex? =? 0;
)
First, examples of labels and label content and associated attributes.
Then use AttachMethodData object label attached to the chart position.
GroupIndex refers Index chart. (First article mentioned WebChart tacit support two charts)
SeriesIndex refers sequence Index.
PointIndex? Refers to the sequence of elements in the index.
Once set up is complete, the effect plans are as follows:
?
Third, 3D effects can be achieved.
1) Open 3D effects.
C1WebChart1.ChartGroups [0]. Use3D? =? True;
3D style to show that the steps must exist.
3) set up 3D style
/ / 3D graphics depth
C1WebChart1.ChartArea.PlotArea.View3D.Depth? = 20;
/ / Y axis as a reference? Rotation angle (only x-axis, this attribute invalid)
C1WebChart1.ChartArea.PlotArea.View3D.Rotation? = 90;
/ / X-axis as a reference? Tilt angle
C1WebChart1.ChartArea.PlotArea.View3D.Elevation? = 30;
/ / 3-D graphics of the shadow effect
C1WebChart1.ChartArea.PlotArea.View3D.Shading? =? ShadingEnum.ColorDark;
PlotArea style is the use of 3D object attributes to set View3D.
The above four major attribute settings.
Showing results are as follows:
Fourth, the concept of added
Speaking before the might of the region relatively easy to confuse the graphics, graphics below to introduce a graphics region:
Grey WebChart for the whole region, the corresponding object is this.C1WebChart1.
Orange for the regional charts, for the corresponding object this.C1WebChart1.ChartArea.
Green for the graphics, for the corresponding object this.C1WebChart1.ChartArea.PlotArea.
Red for the title on the chart, the corresponding targets this.C1WebChart1.Header.
Blue for the next chart heading for the corresponding object this.C1WebChart1.Footer.
Related objects can be set to use regional styles effects. These attributes can be used to understand quickly set up some simple window style.
5, the end of
I hope that, through some examples of a more comprehensive introduction to the main target of WebChart use. The next will be the production of demonstration Column. The example of the complete code download the following address:
Posted on 2007-03-21 22:03 kdboy reading (203) Comments (0) edit their collections quoted Category: ASP.NET






