{"size": 1519, "ext": "js", "max_stars_repo_path": "public/assets/js/behaviour/Visualisasi/stacked.js", "max_stars_repo_name": "GalihRendis/Keuangan-Pribadi", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/assets/js/behaviour/Visualisasi/stacked.js", "max_issues_repo_name": "GalihRendis/Keuangan-Pribadi", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/assets/js/behaviour/Visualisasi/stacked.js", "max_forks_repo_name": "GalihRendis/Keuangan-Pribadi", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.3166666667, "max_line_length": 97, "alphanum_fraction": 0.7221856485}
function stackedBar($data, $id, $nameSeries){
	am4core.ready(function() {

// Themes begin
am4core.useTheme(am4themes_animated);
// Themes end

// Create chart instance
var chart = am4core.create($id, am4charts.XYChart);


// Add data
chart.data = $data;

// Create axes
var categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "label";
categoryAxis.renderer.grid.template.location = 0;


var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
valueAxis.renderer.inside = true;
valueAxis.renderer.labels.template.disabled = true;
valueAxis.min = 0;

// Create series
function createSeries(field, name) {
  
  // Set up series
  var series = chart.series.push(new am4charts.ColumnSeries());
  series.name = name;
  series.dataFields.valueY = field;
  series.dataFields.categoryX = "label";
  series.sequencedInterpolation = true;
  
  // Make it stacked
  series.stacked = true;
  
  // Configure columns
  series.columns.template.width = am4core.percent(60);
  series.columns.template.tooltipText = "[bold]{name}[/]\n[font-size:14px]{categoryX}: {valueY}";
  
  // Add label
  var labelBullet = series.bullets.push(new am4charts.LabelBullet());
  labelBullet.label.text = "{valueY}";
  labelBullet.locationY = 0.5;
  labelBullet.label.hideOversized = true;
  
  return series;
}

for (var i = 0; i < $nameSeries.length; i++) {
	createSeries($nameSeries[i].ukuran_perusahaan, $nameSeries[i].ukuran_perusahaan);
}

// Legend
chart.legend = new am4charts.Legend();

});
}