- Home
- Forum
- ASP.NET MVC - EJ 2
- Change Color of Line and Points in Line Graph
Change Color of Line and Points in Line Graph
Good Morning,
How do you add a specific color to the line and points in a line graph. My line graph is as follows:
@Html.EJS().Chart("container2").ChartArea(area => area.Border(br => br.Color("transparent"))).Series(series =>
{
series.Type(Syncfusion.EJ2.Charts.ChartSeriesType.Line).Width(2).XName("xValue")
.Marker(mr => mr.Visible(true).Width(10).Height(10)).YName("yValue")
.DataSource(ViewBag.dataSource2).Name("Masses Performed").Add();
}).PrimaryXAxis(px => px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category)
).Title("Total Masses Performed").Tooltip(tt => tt.Enable(true)).Annotations(an =>
{
an.Region(Syncfusion.EJ2.Charts.Regions.Chart).X("2014").Y("50").CoordinateUnits(Syncfusion.EJ2.Charts.Units.Point);
}).Render()
Where do I add the color customization?
Thanks,
Steven
SIGN IN To post a reply.
3 Replies
DG
Durga Gopalakrishnan
Syncfusion Team
December 7, 2020 12:19 PM UTC
Hi Steven,
We suggest you specify chart series type asMultiColoredLineandPointColorMappingproperty to map provided colors for line and marker. We have attached sample for your reference.
| Series(series =>
{ series.Type(Syncfusion.EJ2.Charts.ChartSeriesType.MultiColoredLine)
.PointColorMapping("color").Add();
}) |
Please revert us if you have any concerns.
Regards,
Durga G
ST
Steven
December 22, 2020 01:46 AM UTC
I'm trying to make the line and points purple. I just need one color. I tried the following statement but I get an error saying string[] is not a delegate type. I don't get an option to use Palette just Palettes and I get that error every time.
@(Html.EJ().Chart("chartContainer").Palettes(pl => pl.Add("grey"))
DG
Durga Gopalakrishnan
Syncfusion Team
December 22, 2020 02:46 PM UTC
Hi Steven,
You can either useFillproperty of chart series orPalettesproperty to customize the color of series. We have modified sample and attached for your reference.
| @Html.EJS().Chart("container").Palettes(ViewBag.palettes).Render() |
Kindly revert us if you have any concerns.
Regards,
Durga G
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
ST Steven
- Dec 4, 2020 03:24 PM UTC
- Dec 22, 2020 02:46 PM UTC