|
Trendlayer adding double legend |
Posted by Kevin on Jun-18-2018 19:09 |
|
Hi guys - cannot find this in the forum so any help very much appreciated.
When I add a trendlayer to a stacked chart I get duplicate legends ( one for layer and one for trendlayer )
Dim layer As BarLayer = c.addBarLayer2(Chart.Stack)
layer.addDataSet(table.getCol(1), -1, "directory")
layer.addDataSet(table.getCol(2), -1, "advertising")
layer.addDataSet(table.getCol(3), -1, "services")
layer.addDataSet(table.getCol(4), -1, "shop")
c.addTrendLayer(table.getCol(1), -1, "directory").setLineWidth(3)
c.addTrendLayer(table.getCol(2), -1, "advertising").setLineWidth(3)
c.addTrendLayer(table.getCol(3), -1, "services").setLineWidth(3)
c.addTrendLayer(table.getCol(4), -1, "shop").setLineWidth(3)
Dim b As LegendBox = c.addLegend(1060, 50, True, "arial.ttf", 10)
b.setBackground(Chart.Transparent, Chart.Transparent)
b.setKeyBorder(Chart.SameAsMainColor)
b.setReverse()
I then get a legend with :
directory
advertising
services
shop
directory
advertising
services
shop
Any way to not add the trendlayer to the legend ? |
Re: Trendlayer adding double legend |
Posted by Peter Kwan on Jun-18-2018 23:23 |
|
Hi Kevin,
There are two methods:
(a) If your trend layer does not have a name, then there will be no legend:
c.addTrendLayer(table.getCol(1), -1).setLineWidth(3)
(b) If you must add a name to the trend layer, you can use Layer.setLegendOrder to disable the legend entry:
Dim layer1 As TrendLayer = c.addTrendLayer(table.getCol(1), -1)
layer1.setLineWidth(3)
layer1.setLegendOrder(Chart.NoLegend)
Hope this can help.
Regards
Peter Kwan |
Re: Trendlayer adding double legend |
Posted by Kevin on Jun-19-2018 16:32 |
|
Brillaint support as always - many tahnks |
|