In a bar chart, clicking a dataseries name in the legend makes that dataseries' color disappear from the chart
Last updated 2022-02-10 ·Reference W-1482247 ·Reported By 18 users
Summary
In a bar chart, clicking on the name of a data series on a Visualforce chart's legend makes the colours provided via the chart's colorset attribute be ignored.
Repro
1) Create the following VF page and controller:
<apex:page controller="ChartController">
<apex:chart data="{!chartdata}" width="300" height="200" colorset="#00FF33,#9900CC,#FFFF33" theme="Category1">
<apex:axis type="Category" position="left" fields="name"/>
<apex:axis type="Numeric" position="bottom" fields="data1,data2,data3"/>
<apex:legend position="right"/>
<apex:barSeries orientation="horizontal" axis="bottom" xField="data1,data2,data3" yField="name"/>
</apex:chart>
</apex:page>
public class ChartController {
public List <Data> getData() {
return ChartController.getChartData();
}
public static List <Data> getChartData() {
List <Data> data = new List <Data> ();
data.add(new Data('Jan', 30, 25,50));
data.add(new Data('Feb', 44, 30, 23));
data.add(new Data('Mar', 25, 30, 45));
return data;
}
public class Data {
public String name { get; set; }
public Integer data1 { get; set; }
public Integer data2 { get; set; }
public Integer data3 { get; set; }
public Data(String name, Integer data1, Integer data2, Integer data3) {
this.name = name;
this.data1 = data1;
this.data2 = data2;
this.data3 = data3;
}
}
}
2) Go to the page and click on "data1" on the legend. Notice the custom colours provided via the colorset attribute are lost. Clicking on data2, data3, and then back on data1 shows the sequence seen in this image: https://c.na1.content.force.com/servlet/servlet.ImageServer?id=01530000002ngCw&oid=00D000000000062&lastMod=1363799202000
Workaround
None at this time
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.