We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Set colors in line chart mvc

Thread ID:

Created:

Updated:

Platform:

Replies:

141530 Dec 17,2018 01:09 AM UTC Dec 17,2018 11:59 AM UTC ASP.NET MVC - EJ 2 1
loading
Tags: Chart
jsu
Asked On December 17, 2018 01:09 AM UTC

Hi Team,

How to set colors for the lines in line chart with multiple series? Also, please provide the code to set y axis label position on top.


Thanks in advance

Dharanidharan Dharmasivam [Syncfusion]
Replied On December 17, 2018 11:59 AM UTC

Hi Jsu, 
 
Greetings from Syncfusion. 
 
Query #1: How to set colors for the lines in line chart with multiple series? 
We have analyzed your requirement. Your requirement can be achieved using the fill property of the series. You can also use the Palettes property of chart. Here you can assign array of colors and then bind to chart. Find the code snippet below to achieve this. 
 
[ChartController.cs] 
 
string[] color = new string[] { "#4286f4", "#f4b642", "#f441a9" }; 
ViewBag.seriesColors = color; 
 
[ChartFEatures.cshtml] 
@Html.EJS().Chart("container").Palettes(ViewBag.seriesColors).Render() 
 
 
 
Query #2: Also, please provide the code to set y axis label position on top. 
 
Here we have set the data labels position to the top using the Position property of series.marker.dataLabel. Also, we have moved the y axis labels to inside the axis. If your query is misunderstood at our kindly revert us with more information on your query. The sample can be found below. 
 
 
 
Thanks, 
Dharani. 
 
 
 
 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;