Search results

Appearance

Custom Color Palette

You can customize the default color of series or points by providing a custom color palette of your choice by using the Palettes property.

custom.razor
@using Syncfusion.EJ2.Blazor.Charts

<EjsChart Title="Olympic Medals" Palettes="@palettes">
        <ChartPrimaryXAxis ValueType="Syncfusion.EJ2.Blazor.Charts.ValueType.Category"> 
        </ChartPrimaryXAxis> 
  
        <ChartSeriesCollection> 
            <ChartSeries DataSource="@MedalDetails" XName="Country" YName="Gold" Type="ChartSeriesType.Column">
            </ChartSeries> 
            <ChartSeries DataSource="@MedalDetails" XName="Country" YName="Silver" Type="ChartSeriesType.Column">
            </ChartSeries> 
            <ChartSeries DataSource="@MedalDetails" XName="Country" YName="Bronze" Type="ChartSeriesType.Column">
            </ChartSeries>  
        </ChartSeriesCollection> 
</EjsChart> 

@code{
    public class ChartData
    {
        public string Country;
        public double Gold;
        public double Silver;
        public double Bronze;
    }
    public List<ChartData> MedalDetails = new List<ChartData> 
    {
         new ChartData{ Country= "USA", Gold=50, Silver=70, Bronze=45 },
         new ChartData{ Country="China", Gold=40, Silver= 60, Bronze=55 },
         new ChartData{ Country= "Japan", Gold=70, Silver= 60, Bronze=50 },
         new ChartData{ Country= "Australia", Gold=60, Silver= 56, Bronze=40 },
         new ChartData{ Country= "France", Gold=50, Silver= 45, Bronze=35 },
         new ChartData{ Country= "Germany", Gold=40, Silver=30, Bronze=22 },
         new ChartData{ Country= "Italy", Gold=40, Silver=35, Bronze=37 },
         new ChartData{ Country= "Sweden", Gold=30, Silver=25, Bronze=27 }
    };
    public String[] palettes = new String[] { "#E94649", "#F6B53F", "#6FAAB0" };
}

Custom Color Palette

Chart Area Customization

Customize the Chart Background

Using Background and Border properties, you can change the background color and border of the chart.

area.razor
@using Syncfusion.EJ2.Blazor.Charts

<EjsChart Title="Olympic Medals" Background="skyblue">
        <ChartArea>
            <ChartAreaBorder Color="#FF0000" Width="2"></ChartAreaBorder>
        </ChartArea>
  
        <ChartPrimaryXAxis ValueType="Syncfusion.EJ2.Blazor.Charts.ValueType.Category">
        </ChartPrimaryXAxis>
  
        <ChartSeriesCollection>
            <ChartSeries DataSource="@MedalDetails" XName="Country" YName="Gold" Type="ChartSeriesType.Column">
            </ChartSeries>
        </ChartSeriesCollection>
</EjsChart>

@code{
public class ChartData
{
    public string Country;
    public double Gold;
}
public List<ChartData> MedalDetails =  new List<ChartData>
    {
    new ChartData{ Country= "USA", Gold=50  },
    new ChartData{ Country="China", Gold=40 },
    new ChartData{ Country= "Japan", Gold=70 },
    new ChartData{ Country= "Australia", Gold=60},
    new ChartData{ Country= "France", Gold=50 },
    new ChartData{ Country= "Germany", Gold=40 },
    new ChartData{ Country= "Italy", Gold=40 },
    new ChartData{ Country= "Sweden", Gold=30 }
    };
}

Customize the Chart Background

Chart Margin

You can set margin for chart from its container through Margin property.

margin.razor
@using Syncfusion.EJ2.Blazor.Charts

<EjsChart Title="Olympic Medals" Background="skyblue">
        <ChartArea>
            <ChartAreaBorder Color="#FF0000" Width="2"></ChartAreaBorder>
        </ChartArea>
  
        <ChartMargin Left="40" Right="40" Top="40" Bottom="40"></ChartMargin>
  
        <ChartPrimaryXAxis ValueType="Syncfusion.EJ2.Blazor.Charts.ValueType.Category">
        </ChartPrimaryXAxis>
  
        <ChartSeriesCollection>
            <ChartSeries DataSource="@MedalDetails" XName="Country" YName="Gold" Type="ChartSeriesType.Column">
            </ChartSeries>
        </ChartSeriesCollection>
</EjsChart>

@code{
public class ChartData
{
    public string Country;
    public double Gold;
}
public List<ChartData> MedalDetails =  new List<ChartData>
    {
    new ChartData{ Country= "USA", Gold=50  },
    new ChartData{ Country="China", Gold=40 },
    new ChartData{ Country= "Japan", Gold=70 },
    new ChartData{ Country= "Australia", Gold=60},
    new ChartData{ Country= "France", Gold=50 },
    new ChartData{ Country= "Germany", Gold=40 },
    new ChartData{ Country= "Italy", Gold=40 },
    new ChartData{ Country= "Sweden", Gold=30 }
    };
}

Chart Area Background

The chart area background can be customized by using the Background property in the ChartArea.

background.razor
@using Syncfusion.EJ2.Blazor.Charts

<EjsChart Title="Olympic Medals" Background="skyblue"> 
        <ChartPrimaryXAxis ValueType="Syncfusion.EJ2.Blazor.Charts.ValueType.Category"> 
        </ChartPrimaryXAxis>  
  
        <ChartSeriesCollection> 
            <ChartSeries DataSource="@MedalDetails" XName="Country" YName="Gold" Type="ChartSeriesType.Column">
            </ChartSeries>
        </ChartSeriesCollection>
</EjsChart>

@code{
public class ChartData
{
    public string Country;
    public double Gold;
}
public List<ChartData> MedalDetails =  new List<ChartData>
    {
    new ChartData{ Country= "USA", Gold=50  },
    new ChartData{ Country="China", Gold=40 },
    new ChartData{ Country= "Japan", Gold=70 },
    new ChartData{ Country= "Australia", Gold=60},
    new ChartData{ Country= "France", Gold=50 },
    new ChartData{ Country= "Germany", Gold=40 },
    new ChartData{ Country= "Italy", Gold=40 },
    new ChartData{ Country= "Sweden", Gold=30 }
    };
}

Animation

You can customize animation for a particular series using Animation property. You can enable or disable animation of the series using Enable property. Duration specifies the duration of an animation and Delay allows us to start the animation at desire time.

animation.razor
@using Syncfusion.EJ2.Blazor.Charts

<EjsChart Title="Olympic Medals">
        <ChartPrimaryXAxis ValueType="Syncfusion.EJ2.Blazor.Charts.ValueType.Category">
        </ChartPrimaryXAxis>
  
        <ChartSeriesCollection>
            <ChartSeries DataSource="@MedalDetails" Name="Gold" XName="Country" Width="2" Opacity="1" YName="Gold" Type="ChartSeriesType.Column">
                <ChartSeriesAnimation Enable="true" Duration="2000" Delay="200"></ChartSeriesAnimation>
                <ChartSeriesBorder Width="3" Color="red"></ChartSeriesBorder>
            </ChartSeries>
        </ChartSeriesCollection>
</EjsChart>

@code{
    public class ChartData
    {
        public string Country;
        public double Gold;
    }
    public List<ChartData> MedalDetails = new List<ChartData> 
    {
        new ChartData{ Country= "USA", Gold=50, Silver=70, Bronze=45 },
        new ChartData{ Country="China", Gold=40, Silver= 60, Bronze=55 },
        new ChartData{ Country= "Japan", Gold=70, Silver= 60, Bronze=50 },
        new ChartData{ Country= "Australia", Gold=60, Silver= 56, Bronze=40 },
        new ChartData{ Country= "France", Gold=50, Silver= 45, Bronze=35 },
        new ChartData{ Country= "Germany", Gold=40, Silver=30, Bronze=22 },
        new ChartData{ Country= "Italy", Gold=40, Silver=35, Bronze=37 },
        new ChartData{ Country= "Sweden", Gold=30, Silver=25, Bronze=27 }
    };
}

Chart Title

Chart can be given a title using Title property, to show the information about the data plotted.

title.razor
@using Syncfusion.EJ2.Blazor.Charts

<EjsChart Title="Olympic Medals">
        <ChartTitleStyle Size="23px" Color="red" FontFamily="Arial" FontWeight="regular" FontStyle="italic"></ChartTitleStyle>
  
        <ChartPrimaryXAxis ValueType="Syncfusion.EJ2.Blazor.Charts.ValueType.Category">
        </ChartPrimaryXAxis> 
  
        <ChartSeriesCollection>
            <ChartSeries DataSource="@MedalDetails" XName="Country" YName="Gold" Type="ChartSeriesType.Column">
            </ChartSeries>
        </ChartSeriesCollection>
</EjsChart>

@code{
public class ChartData
{
    public string Country;
    public double Gold;
}
public List<ChartData> MedalDetails =  new List<ChartData>
    {
    new ChartData{ Country= "USA", Gold=50  },
    new ChartData{ Country="China", Gold=40 },
    new ChartData{ Country= "Japan", Gold=70 },
    new ChartData{ Country= "Australia", Gold=60},
    new ChartData{ Country= "France", Gold=50 },
    new ChartData{ Country= "Germany", Gold=40 },
    new ChartData{ Country= "Italy", Gold=40 },
    new ChartData{ Country= "Sweden", Gold=30 }
    };
}

Chart Title

Chart SubTitle

Chart can be given a subtitle using SubTitle property, to show the information about the data plotted.

subtitle.razor
@using Syncfusion.EJ2.Blazor.Charts

<EjsChart Title="Olympic Medals" SubTitle="Medals">
        <ChartSubTitleStyle FontFamily="Arial" FontStyle="italic" FontWeight="regular" Size="18px" Color="red">></ChartSubTitleStyle>
  
        <ChartTitleStyle FontFamily="Arial" FontStyle="italic" FontWeight="regular" Size="23px" Color="red"></ChartTitleStyle>
       
        <ChartPrimaryXAxis ValueType="Syncfusion.EJ2.Blazor.Charts.ValueType.Category">
        </ChartPrimaryXAxis>
  
        <ChartSeriesCollection>
            <ChartSeries DataSource="@MedalDetails" XName="Country" YName="Gold" Type="ChartSeriesType.Column">
            </ChartSeries>
        </ChartSeriesCollection>
</EjsChart>

@code{
public class ChartData
{
    public string Country;
    public double Gold;
}
public List<ChartData> MedalDetails =  new List<ChartData>
    {
    new ChartData{ Country= "USA", Gold=50  },
    new ChartData{ Country="China", Gold=40 },
    new ChartData{ Country= "Japan", Gold=70 },
    new ChartData{ Country= "Australia", Gold=60},
    new ChartData{ Country= "France", Gold=50 },
    new ChartData{ Country= "Germany", Gold=40 },
    new ChartData{ Country= "Italy", Gold=40 },
    new ChartData{ Country= "Sweden", Gold=30 }
    };
}

Chart SubTitle

See Also