Componentone webchart for ASP. net basics (2)

Source: Internet
Author: User

1. Grouping the chart

Chart Configuration

After adding the control, use the built-in Wizard to customize the External table. Right-click the chart and select "chart wizard". You can select the desired chart.

Table type.

You can set the backcolor and chartstyle of the chart through the attribute.

The chart wizard and window attributes are very powerful. You can set the attributes of various charts without writing code. You can use the chart wizard to assemble them.

Chart data, but it is rarely applicable to actual situations (the number of numbers and points)

After the report is configured, you can save it as a file. In this way, you can reuse it in other charts. Right-click the chart and select Save chart"

. You can right-click and select "load chart" for reuse. You can pre-define the chart template. You can also use the loadchartfromfile method to dynamically load the chart.


2. Adding User Interaction with imageareas

Add User image area interaction

C1webchart and c1webchart3d allow you to associate tooltip with graph elements, so the chart responds to mouse events. These are HTML Image Processing Using the client.

The image is defined in the imageareas attribute. It is a collection of tooltips and hrefs chart elements. toolTips is used to set the display prompt that is displayed on the chart, and hrefs is used to set the trigger event when the chart element is clicked.

Edit the imageareas set of form attributes. click the button to bring up the settings page.

For example, if you select "chartdata" and set the tooltip attribute to "{# yval: c }".

3. Adding data to the chart

Add data to Charts

The last step is to add data to the chart you want to display. In this step, you need to write code

In most applications, data comes from ADO. net dataset, usually combined with conversion: filtering, sorting, summary. it is also possible that the data comes from other data sources, such as arrays and custom data structures. no matter where the data comes from, you can use the chartdataseries class to add the data.

For example, bind data from a able to a chart

Private void page_load (Object sender, eventargs E)

{

// Get dataset (from DB or cache)

Dataset DS = getdataset ();

// Filter the data

Dataview DV = new dataview (Ds. Tables ["sales"]);

DV. rowfilter = "productsales> = 40000 ";

DV. Sort = "productsales ";

// Create an array of data points

Pointf [] DATA = new pointf [DV. Count]

For (INT I = 0; I <data. length; I ++)

{

Float y = float. parse (DV [I] ["productsales"]. tostring ());

Data [I] = new pointf (I, y );

}

// Populate chart data points

Chartdataseries series = _ c1webchart. chartgroups [0]. chartdata. serieslist [0];

Series. pointdata. copydatain (data );

}

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.