Essential Studio for Asp.Net | Demos

SHOWCASE SAMPLES
Showcase samples

    EnableSmartLabels
    <%@ Page Title="Chart-Smart Labels-ASP.NET-SYNCFUSION"   Language="C#"  MetaDescription="This sample demonstrates how to render smart data labels for series using Syncfusion ASP.NET Web Forms Chart control" MasterPageFile="~/Samplebrowser.Master" AutoEventWireup="true" CodeBehind="SmartLabels.aspx.cs" Inherits="WebSampleBrowser.Chart.SmartLabels" %>
    <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ScriptSection">
    
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ControlsSection" runat="server">
      <div id="container">
          <script type="text/javascript" src="../Scripts/ChartData.js"></script>
          <ej:Chart ID="Chart1" runat="server" Height="600" IsResponsive="true" OnClientLoad="onChartLoad" >
               <PrimaryXAxis Title-Text="Years" EdgeLabelPlacement="hide"/>
               <PrimaryYAxis LabelFormat="{value}%" Title-Text="Profit percentage"/>
               <CommonSeriesOptions Type="Line" Border-Width="2" Tooltip-Visible="true" Marker-Size-Height="8" 
                   Marker-Size-Width="8" Marker-DataLabel-Visible="true" Marker-DataLabel-EnableContrastColor="true"
                    Marker-DataLabel-Shape="rectangle"  Marker-DataLabel-ConnectorLine-Width="1" Marker-Visible="true" EnableAnimation="True"/>
               <Series>
                 <ej:Series EnableSmartLabels="True" Name="Profit percentage" Fill="#1ab0b0" XName="Xvalue" YName="YValue1"></ej:Series>
               </Series>
              <Title Text="Sum of profit percentage from various share investments"></Title>
              <Legend Visible="false"></Legend>
          </ej:Chart>
      </div>
    </asp:Content>
    
    <asp:Content ID="Content3" ContentPlaceHolderID="StyleSection" runat="server">
    
    </asp:Content>
    
    <asp:Content ID="Content4" runat="server" ContentPlaceHolderID="PropertySection">
        <div id="sampleProperties">
         <div class="row">
              <div><br/><center>
                   <input type="checkbox" id="enableSmartLabels" value="enableSmartLabels" checked> EnableSmartLabels
                 </center>
              </div>
          </div>
         </div>
        <script type="text/javascript">
            $("#enableSmartLabels").change(function () {
                var chart = $(".e-datavisualization-chart").ejChart("instance");
                if ($("#enableSmartLabels").is(":checked"))
                    chart.model.series[0].enableSmartLabels = true;
                else 
                    chart.model.series[0].enableSmartLabels = false;
                chart.redraw();
            });
    
            $("#sampleProperties").ejPropertiesPanel();
        </script>
    </asp:Content>
    
    
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace WebSampleBrowser.Chart
    {
        public partial class SmartLabels : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e){
                List<SmartLabelsData> data = new List<SmartLabelsData>();
                data.Add(new SmartLabelsData(2005, 28));
                data.Add(new SmartLabelsData(2006, 24));
                data.Add(new SmartLabelsData(2006, 24));
                data.Add(new SmartLabelsData(2006, 24));
                data.Add(new SmartLabelsData(2007, 26));
                data.Add(new SmartLabelsData(2008, 27));
                data.Add(new SmartLabelsData(2008, 27));
                data.Add(new SmartLabelsData(2009, 32));
                data.Add(new SmartLabelsData(2010, 34));
                data.Add(new SmartLabelsData(2010, 34));
                data.Add(new SmartLabelsData(2010, 34));
                data.Add(new SmartLabelsData(2010, 34));
                data.Add(new SmartLabelsData(2011, 29));
                data.Add(new SmartLabelsData(2012, 31));
    
                //Binding Datasource to Chart
                this.Chart1.DataSource = data;
                this.Chart1.DataBind();
    
                //Setting range for PrimaryXAxis
                this.Chart1.PrimaryXAxis.Range.Min = 2004;
                this.Chart1.PrimaryXAxis.Range.Max = 2013;
                this.Chart1.PrimaryXAxis.Range.Interval = 1;
    
                //Setting range for PrimaryYAxis
                this.Chart1.PrimaryYAxis.Range.Min = 20;
                this.Chart1.PrimaryYAxis.Range.Max = 40;
                this.Chart1.PrimaryYAxis.Range.Interval = 4;
    
            }
        }
      
    }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Data;
    using System.ComponentModel;
    using System.Web.Script.Serialization;
      [Serializable]
        public class SmartLabelsData
        {
            public SmartLabelsData(double xval, double yvalue1)
            {
                this.Xvalue = xval;
                this.YValue1 = yvalue1;
            }
            public double Xvalue
            {
                get;
                set;
            }
            public double YValue1
            {
                get;
                set;
            }
        }