In this page, users will be well informed of building and customizing pie chart using C# programming language with KT.UI ASP.NET AJAX. If you have read the article on how to build pie chart graph using ASPX codes, you will save much time in drawing pie chart with C#.
Our chart control library is developed based on AJAX technique, thus, in order to experience this effect, we need to drag an "AjaxPanel" component to "aspx" page when we are building pie chart. Afterwards, we are supposed to drag a chart control to "AjaxPanel" from Toolbox, and modify variable chart properties via corresponding C# codes added in "aspx.cs" file.
Like demonstrating pie chart making using ASPX, we are also about to discuss the processes of creating pie chart within C# application in two parts: pie chart basic settings and pie settings. Besides, we provide rich client side and server side events, so you can make the pie chart interactive and dynamical. After you click one slice of pie chart, this slice may pop outside with animation, separate to the whole pie chart. So users can compare and analysis the pie cahrt more easily.
How to Set Chart Type Using C#
After we have added the chart control to "AjaxPanel" at the very beginning, we can add and debug following C# sample codes in "aspx.cs file" to easily set pie chart type:
Also, here is another series codes to set chart type:
Either of the above two ways can help us successfully start a pie chart project within C# ASP.NET application.
How to Set Chart Style Using C#
KT.UI ASP.NET AJAX library also offers more advanced and rich options to set and define chart styles to fulfill variable needs. The individualized skin and background can distinguish your chart from normal documents. And users can choose the customized chart template to add specified effects to the web pie chart. If you want, you can draw the pie chart in 2D and 3D effects.
KaxChart1.Skin = "Black";
How to Set Chart Title Using C#
A good title can highly summarize your chart contents. By using the KT.UI ChartTitle object, users can quickly and accurately add and modify pie chart title. Title text font, rotation, the title size, border, text color, background color are all supported. In additional, if you want to create a sub title behind the primary title, our pie chart web control can also resolve it. Want to get the detailed and comprehensive guides of chart title element, please go to: set chart title element in c#.
How to set Chart Series Using C#
Data series is the nuclear part to a chart. As to pie chart, we can choose to add only single series of data, not same to other chart type can insert multiple data series. And the series of data will be displayed in the form of a separate pie slice. It means if one data is big, it will take the most percentages of the whole data capacity, and the pie slice shows this data will display bigger degrees and areas than others.
Following snippet C# example codes show how to add two series of data into pie chart, you can also see more chart series settings in: how to set chart series element using C#.
Finishing inserting and adding data series, we are capable of setting each pie sector with different color to have better visual effects and let chart data seem more recognizable. Each pie slice can hold one type color, so the pie chart may look like colorful, and the legend can take the same color of the slice it descripted.
Users can check here to see the online sample image of pie chart.
ASP.NET AJAX UI Controls
ASP.NET AJAX Chart UI ControlOverviewGetting Started
Chart ElementDiagramSeriesAxesLegendCaptionTickData Grid
Chart TypeBar ChartPoint ChartLine ChartPie ChartArea ChartGantt ChartBubble ChartBezier ChartSpline ChartSpline Area ChartCandle Chart Chart With StackedFull Stacked Chart
FeaturesAutomatic LayoutAutomatic Text-wrappingScrollingEmpty ValuesScale BreakMultiline LabelsWise LabelsMarking AreasMultiple TypesInteractiveDrill DownShadowEdting
Data BindingArray DataList DataDatabase DataXML Data
Chart StyleChart SkinASP.NET AJAX Grid UI Control