2

I am creating one line bar graph using apex:chart . In this graph values are not getting displayed.

Here is the following code for it VF Page

  <apex:chart height="400" width="900" data="{!GraphData}">
                    <apex:axis type="Numeric" position="left" fields="data1" title="Amount" grid="true"/>
                    <apex:axis type="Category" position="bottom" fields="name" title="Month of the Year" />
                    <apex:lineSeries axis="left"  xField="name" yField="data1" markerType="circle" markerSize="10" markerFill="#F08F35"/>
                    </apex:chart>

Controller

public with sharing class NewOfferPageExtension {
 public List<Data> GraphData{get;set;}
   public NewOfferPageExtension(ApexPages.StandardController controller) {
       GraphData = new List<Data>();
        GraphData .add(new Data('Jan', 30, 90, 55));
        GraphData .add(new Data('Feb', 44, 15, 65));
        GraphData .add(new Data('Mar', 25, 32, 75));
        GraphData .add(new Data('Apr', 74, 28, 85));
        GraphData .add(new Data('May', 65, 51, 95));
        GraphData .add(new Data('Jun', 33, 45, 99));
        GraphData .add(new Data('Jul', 92, 82, 30));
        GraphData .add(new Data('Aug', 87, 73, 45));
        GraphData .add(new Data('Sep', 34, 65, 55));
        GraphData .add(new Data('Oct', 78, 66, 56));
        GraphData .add(new Data('Nov', 80, 67, 53));
        GraphData .add(new Data('Dec', 17, 70, 70));


    }

     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;
        }
    }
}

The values are not getting displayed

6
  • 3
    I just ran the code you posted in an empty page and the data1 line rendered fine and I could add the other lines too. So the above code is good - perhaps you changed something when posting here? Or there is something else in the page affecting the chart? Otherwise a mystery to me what the problem is.
    – Keith C
    Mar 19, 2016 at 12:41
  • @KeithC No I didn't change anything while posting code.I have included static resource in the page for CSS Mar 21, 2016 at 4:57
  • Suggest you start with only the above code (which does display a line for me and confirm it does for you) and then add back in other page content to find what is causing the problem.
    – Keith C
    Mar 21, 2016 at 9:02
  • ok let me try and i will let you know Mar 21, 2016 at 9:43
  • @KeithC: i got the problem : It is CSS issue Mar 21, 2016 at 11:34

1 Answer 1

1

Because of the CSS issues it is not happening so we try to solve the problem of CSS and then try it.

After removing the bootstrap CSS from page it works fine.

4
  • Shantanu.. Nice work. Can you pls add few lines or any suggestion how you fixed this issue using CSS.
    – Ratan Paul
    Mar 21, 2016 at 11:48
  • Actually this error is because of Bootstrap CSS Mar 21, 2016 at 12:32
  • @ShantanuMahajan what you have changed in bootstrap CSS that resolved this issue ?
    – Ratan Paul
    Mar 21, 2016 at 12:38
  • 1
    @sfdcweb: I have commented it the whole Bootstrap CSS Mar 21, 2016 at 12:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .