how to change line color in linechart when dots and line color are not the same

2 Answers 77 Views
Chart
Nhut
Top achievements
Rank 1
Iron
Nhut asked on 20 Jun 2023, 09:50 AM
here is my code 
@(Html.Kendo().Chart<Commsights.Data.DataTransferObject.DashbroadDataTransfer>()
                                                                .Name("LineChart_Customer_Processed")
                                                                .DataSource(dataSource => dataSource
                                                                .Read(read => read.Action("Chart_CountData_DaXuLyTolist", "Dashbroad").Data("FilterCompany"))
                                                                .Group(group => group.Add(model => model.CompanyName))
                                                                .Sort(sort => sort.Add(model => model.DatePublish).Ascending())
                                                                )
                                                                .Events(events => events.SeriesClick("onSeriesClick"))
                                                                .Theme("material")
                                                                .Series(series =>
                                                                {
                                                                    series.Line(model => model.ID_Count)
                                                                    .Name("#= group.value #")
                                                                    .Style(ChartSeriesStyle.Smooth)
                                                                    .CategoryField("DatePublish")
                                                                    .Tooltip(tooltip => tooltip
                                                                    .Visible(true)
                                                                    .Template("#= kendo.toString(category, 'MM/dd') # - #= value # (#= series.name # Article)"))
                                                                    .Width(3).Opacity(0.6)
                                                                   .ColorField("Color");
                                                                })
                                                                .Legend(legend => legend
                                                                .Position(ChartLegendPosition.Bottom)
                                                                )
                                                                .ValueAxis(axis => axis.Numeric()
                                                                .Labels(labels => labels
                                                                .Format("{0}")
                                                                .Skip(2)
                                                                .Step(2)
                                                                )
                                                                )
                                                                .CategoryAxis(axis => axis
                                                                .BaseUnit(ChartAxisBaseUnit.Days)
                                                                .Labels(labels => labels
                                                                .DateFormats(formats => formats.Months("MM/dd"))
                                                                .Rotation(-45)
                                                                )
                                                                )
                                                                .HtmlAttributes(new { style = "width: 100%; height: 400px;" })
                                                                )

I used colorfield() to specify the color of the elements on the chart but I don't understand why the dots at the landmarks are the correct color I specified to load from the store proc, but the lines connect them together wrong color.
Pls help me.

2 Answers, 1 is accepted

Sort by
0
Nhut
Top achievements
Rank 1
Iron
answered on 21 Jun 2023, 03:33 AM


This is pic for the code pls help me,color line not match with dots how to fix

 

0
Alexander
Telerik team
answered on 22 Jun 2023, 06:22 PM

Hi Nhut,

In order to get a better understanding of the scenario would it be possible for you to confirm that the "DashbroadDataTransfer" model has the "Color" field specified for each entry accordingly?

Additionally, providing a samplery JSON representation of your data would be greatly appreciated as well.

With that in mind, I have noticed there is no Telerik UI for ASP.NET Core Licenses associated with your account. Meaning that this further limits our support service as a whole. And the recommended action would be to either purchase or renew an existing license in order to make the most of the suite's features, bug fixes, and support service:

Kind Regards,
Alexander
Progress Telerik

As of R2 2023, the default icon type will be SVG instead of Font. See this blogpost for more information.
Tags
Chart
Asked by
Nhut
Top achievements
Rank 1
Iron
Answers by
Nhut
Top achievements
Rank 1
Iron
Alexander
Telerik team
Share this question
or