Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: PFUN-16763


Warning
  • Be aware that the method api.buildFlexChart is now deprecated. You can find more info in API Documentation.
  • From version 10.0 api.isSyntaxCheck() is replaced with api.isInputGenerationExecution().


Table of Contents

Column Chart, Using Default Template

...

Code Block
languagegroovy
if(api.syntaxCheckisInputGenerationExecution()) return

def customerId = api.getElement("CustomerId")
def customerName = api.getElement("CustomerName")
def specCode = api.getElement("SpecCode")
def specCodeDescription = api.getElement("SpecCodeDescription")

api.buildFlexChart([
  chart: [
    type: "column"
  ],
 
  title: [
    text: "Monthly Volume and AVG NetPrice PU in the last 6 months"
  ],
  subtitle: [
    text: customerName + "  /  " + specCodeDescription
  ],
        xAxis: [
            title: [
                text: 'Date'
            ],
          categories: ["1", "2", "3", "4"],
          //categories: getNetPriceHistory(customerId, specCode)[0]
        ],
        yAxis: [[
          title: [
                text: 'Average Net Price per Unit'
          ],
          labels: [
            format: '{value} BRL'
          ],
          ],
          [
            title: [
                  text: 'Total Volume'
            ],
          opposite: true  
          ],
        ],

    	tooltip: [
        	shared: true
   		],
  
    	legend: [
            layout: 'vertical',
            align: 'left',
            x: 150,
            verticalAlign: 'top',
            y: 120,
            floating: true
            //backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
    	],  
  
        series: [
          [
            name: "Total Volume",
          	type: 'column',
            yAxis: 1,
            data: [4.0, 3.9, 6.5, 9.1]
            //data: getNetPriceHistory(customerId, specCode)[1]
          ],
          [
            name: "Average Net Price per Unit",
          	type: 'spline',
            data: [70.0, 60.9, 90.5, 100.1],
//            data: getNetPriceHistory(customerId, specCode)[2],
            tooltip: [
            	valueSuffix: ' BRL'
        	]
          ]
        ]
])

...

Code Block
languagegroovy
if (api.isSyntaxCheckisInputGenerationExecution()) return


def definition = [
  
   chart: [
     type: "area",
     //step: 'left'
   ],

  xAxis: [
        categories: ['1750', '1800', '1850', '1900', '1950', '1999', '2050'],
       
    ],
  
  
   title: [
     text: "A common FlexChart"
   ],
  
  series: [
    [
        name: 'Asia',
        type: "area",
        
        data: [502, 635, 809, 947, 1402, 3634, 5268]
    ], [
        name: 'Africa',
        type: "area",
        data: [106, 107, 111, 133, 221, 767, 1766]
    ], [
        name: 'Europe',
        type: "area",
        data: [163, 203, 276, 408, 547, 729, 628]
    ], [
        name: 'America',
        type: "area",
        data: [18, 31, 54, 156, 339, 818, 1201]
    ], [
        name: 'Oceania',
        type: "area",
        data: [2, 2, 2, 6, 13, 30, 46]
    ],
    
    [
        name: 'Pavel test',
        type: "column",
        data: [502, 635, 809, 947, 1402, 3634, 5268]
    ]

  ]
  
  
  
 ]

 api.buildFlexChart("AreaTemplate", definition)

...