I have a line series :

<apex:lineSeries axis="left" xField="Date" yField="Opportunity Name" markerType="circle" markerSize="4" markerFill="#8E35EF" />

Is it possible to change the markerType/markerFill based on a value of a field in the same object Opportunity? e.g if x field = good , colour should be green .

1 Answer 1


The easiest way - is to display lineSeries with no markers and display two scatterSeries, where some data is not rendered on a chart.


<apex:chart height="400" width="700" data="{!data}">
<apex:axis type="Numeric" position="left" fields="data1" title="Lines" grid="true"/>
    <apex:axis type="Category" position="bottom" fields="name" title="Month"/>

    <apex:lineSeries axis="left" xField="name" yField="data1" markerType="circle"
                     markerSize="0" markerFill="#515151" strokeColor="515151"/>
    <apex:scatterSeries axis="left" xField="name" yField="data2" 
                        markerType="circle" markerSize="4" markerFill="#1919ff"/>
    <apex:scatterSeries axis="left" xField="name" yField="data3" 
                        markerType="circle" markerSize="4" markerFill="#B0171F"/>


public static List<Data> getRemoteData() {
    return ChartController.getChartData();

public static List<Data> getChartData() {
    List<Data> data = new List<Data>();
    data.add(new Data('Jan', 30, -10, 30));
    data.add(new Data('Feb', 44, 44, -10));
    data.add(new Data('Mar', 25, 25, -10));
    data.add(new Data('Apr', 74, -10, 74));
    return data;

You can populate your data in controller based on some condition. Chart will not display dots where Y-axis is -10.

Chart with colorful markers

I believe, there should be better solution with rendererFn, but its not ordinary

  • Thanks for the answer . I have divided my data into 3 lists . Can you help me with the syntax as to how to I put them ?
    – SFDCRookie
    May 10, 2016 at 10:24
  • I have divided my data by using 3 parts. I have created 3 fields and only 1 set of data will have a value in the field . Else it will have null. How do I use it here?
    – SFDCRookie
    May 10, 2016 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.