1
votes

I'm binding an ASP.NET Chart control with DatabindCrossTable and everything works well, except the legend text that is applied.

My table looks like this:

Year     Week     Value
2015     1        530
2015     2        680
...
2016     1        887
2016     2        991
...
2017     1        990
2017     2        1021
...

I'm binding my Chart control this way:

chrtValuesByWeekByYear.DataBindCrossTable(myTable.Rows, "Year", "Week", "Value", "")

My problem is that the legend text is displaying "Year - YYYY", like the image below. How can I just display "YYYY" in the legend? enter image description here

1

1 Answers

0
votes

There's plenty of opportunity to configure your Legend and Series, but when you call DataBindCrossTable, you're delegating everything to this method. The only thing you're left with is to overwrite whatever you want after the fact.

So, right after you call DataBindCrossTable, you can for instance, simply do:

foreach (Series s in chrtValuesByWeekByYear.Series)
    s.Name = s.Name.Remove(0, 7);

enter image description here