SHARE
TWEET

Untitled

a guest Jun 15th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. am4core.ready(function() {
  2. am4core.useTheme(am4themes_animated);
  3. am4core.useTheme(am4themes_kelly);
  4.  
  5. // Create chart instance
  6. var chart = am4core.create("chartdiv", am4charts.XYChart);
  7.  
  8. chart.marginRight = 400;
  9.  
  10. // Add data
  11. chart.data = [{
  12.   "retailer": "Current",
  13.   "bill": 120,
  14.   "saving": null
  15. }, {
  16.   "retailer": "New",
  17.   "bill": -90,
  18.   "saving": 219
  19. }];
  20.  
  21.  
  22. var categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
  23. categoryAxis.dataFields.category = "retailer";
  24. categoryAxis.title.text = "";
  25. categoryAxis.renderer.grid.template.location = 0;
  26. categoryAxis.renderer.minGridDistance = 20;
  27. categoryAxis.renderer.labels.template.disabled = true;
  28.  
  29.  
  30. var  valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
  31. valueAxis.title.text = "";
  32.  
  33. // Create series
  34. var series = chart.series.push(new am4charts.ColumnSeries());
  35. series.dataFields.valueY = "bill";
  36. series.dataFields.categoryX = "retailer";
  37. series.name = "Bill";
  38. series.fill = "#00af50";
  39. series.stroke = "#00af50";
  40. series.color = "#f2f2f2";
  41. series.tooltipText = "{name}: [bold]{valueY}[/]";
  42. series.stacked = true;
  43.  
  44. var series2 = chart.series.push(new am4charts.ColumnSeries());
  45. series2.dataFields.valueY = "saving";
  46. series2.dataFields.categoryX = "retailer";
  47. series2.name = "Saving";
  48. series2.fill = "#f2f2f2";
  49. series2.stroke = "#f2f2f2";
  50. series2.color = "#00af50";
  51. series2.tooltipText = "{name}: [bold]{valueY}[/]";
  52. series2.stacked = true;
  53.  
  54. chart.cursor = new am4charts.XYCursor();
  55. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top