title: how to make graph section of amcharts dynamic
body: <p>I am creating amcharts from database fields.Here is my code</p>
  
  <pre><code>function Categoriesline(data) {
  
                                                  debugger;
                                                  var databind = JSON.parse(data);
                                                  var chart = AmCharts.makeChart("chartdiv2", {
                                                      "theme": "light",
                                                      "type": "serial",
                                                      "legend": {
                                                      "position": "right",
                                                      "fontSize": 9
                                                       },                                                    
                                                      "marginRight": 80,
                                                      "autoMarginOffset": 20,
                                                      "marginTop": 20,
                                                      "dataProvider": databind,
                                                      "valueAxes": [{
                                                          "id": "v1",
                                                          "axisAlpha": 0.1
  }],
                                                          "graphs": [{                                                            
                                                              "balloonText": "[[category]]&lt;br&gt;&lt;b&gt;value: [[value]]&lt;/b&gt;",
                                                              "bullet": "round",
                                                              "bulletBorderAlpha": 1,                                                            
                                                              "hideBulletsCount": 50,
                                                              "lineThickness": 2,
                                                              "title": "section1",
                                                              "valueField": "section1"
                                                          }, {
                                                              "balloonText": "[[category]]&lt;br&gt;&lt;b&gt;value: [[value]]&lt;/b&gt;",
                                                              "bullet": "round",
                                                              "bulletBorderAlpha": 1,                                                            
                                                              "hideBulletsCount": 50,
                                                              "lineThickness": 2,
                                                              "title": "section2",
                                                              "valueField": "section2"
                                                          }, {
                                                              "balloonText": "[[category]]&lt;br&gt;&lt;b&gt;value: [[value]]&lt;/b&gt;",
                                                              "bullet": "round",
                                                              "bulletBorderAlpha": 1,
                                                              "hideBulletsCount": 50,
                                                              "lineThickness": 2,
                                                              "title": "section3",
                                                              "valueField": "section3"
  }],
  
  
                                                              "categoryField": "categorydescription",
                                                              "categoryAxis": {                                                                
                                                                  "axisAlpha": 0,
                                                                  "minHorizontalGap": 60
                                                              },
                                                              "export": {
                                                                  "enabled": true
                                                              }
                                                          });
  
  
                                                      }
  </code></pre>
  
  <p>All required data from database i am fetching JSON format.</p>
  
  <p>I want to specify the value axis from json itself.Here in above code instead of hardcoding "section1", "section2","section3" i want to assign it from databind object which is having json key name section.</p>
  
  <p>How can i do this ? </p>
  
  <p>I need to add something like </p>
  
  <pre><code>var graph = [];
                  var v;
                  for (var j = 0; j &lt; 6; j++) {
                      graph[j] = new AmCharts.AmGraph();
                      graph[j].valueAxis =databind['section'] ; // we have to indicate which value axis should be used
                      graph[j].title = "Value" + j;
                      v = j.toString();
                      graph[j].valueField = databind['value'];
                      graph[j].bullet = "round";                    
                      chart.addGraph(graph[j]);
                  }
  </code></pre>
  
  <p>Json format
  <a href="https://i.stack.imgur.com/Y4iE1.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y4iE1.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/OPM5b.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OPM5b.jpg" alt="enter image description here"></a></p>
  
  <p>In above pic foreach section i need different lines to draw(multiple line chart).</p>
  
  <pre><code>[
      {
  "Section": "Section1",
          "duration": "1MCount",
          "value": 15},
  
      {
  "Section": "Section2",
          "duration": "1MCount",
          "value": 20},
  
      {
  "Section": "Section1",
          "duration": "3MCount",
          "value": 10},
  
      {
  "Section": "Section2",
          "duration": "3MCount",
          "value": 7},
  
      {
  "Section": "Section3",
          "duration": "3MCount",
          "value": 12}
  ]
  </code></pre>
  
  <p>i have added the json details.</p>