<commit_before>import {Component, OnInit} from "@angular/core";
import {CheckbookService} from "../services/checkbook-service";
import {Checkbook} from "../classes/checkbook";

@Component({
	/*selector: 'bar-chart-demo',*/
	templateUrl: "./templates/bar-template.php"
})

export class BarComponent implements OnInit {

	public barChartData: Array<any> = [];

	public barChartLabels: Array<any> = [];
	public barChartLabelsTemp: Array<any> = [];
	public flattenedLabelsArray: Array<any> = [];

	public barChartOptions:any = {
		scaleShowVerticalLines: false,
		responsive: true
	};

	constructor(private checkbookService: CheckbookService) {}

	ngOnInit(): void {
		this.getCheckbookByCheckbookVendor();
	}

	getCheckbookByCheckbookVendor(): void {
		this.checkbookService.getCheckbookByCheckbookVendor("building", 0)
			.subscribe(cityData => {
				let checkbooks : Checkbook[] = cityData;
				this.barChartData = [];
				this.barChartLabels = [];
				this.barChartLabelsTemp = [];
				this.flattenedLabelsArray = [];


				let vendors = checkbooks.map(checkbookEntry => checkbookEntry.checkbookVendor).filter((checkbookEntry, index, self) => self.indexOf(checkbookEntry) === index);

				for(let vendor of vendors) {
					let xAxis = checkbooks.filter(checkbookEntry => checkbookEntry.checkbookVendor === vendor).map(checkbookEntry => checkbookEntry.checkbookVendor);
					let yAxis = checkbooks.filter(checkbookEntry => checkbookEntry.checkbookVendor === vendor).map(checkbookEntry => checkbookEntry.checkbookInvoiceAmount);
					this.barChartData.push({data: yAxis, label: vendor});
					this.barChartLabelsTemp.push(xAxis);
					console.log(this.barChartData);
				}
				// console.log(this.barChartLabels);
				for(let labelgroup of this.barChartLabelsTemp) {
					for(let label of labelgroup){
						this.flattenedLabelsArray.sort().push(label);
					}
				}
				this.barChartLabels = Array.from(new Set(this.flattenedLabelsArray));


			});
	}

	public barChartLegend:boolean = true;
	public barChartType:string = "bar";

}<commit_msg>bar chart now adds amounts, also set x-axis to "                                            "...... no seriously barChartLabels = ["                                            "]<commit_after>import {Component, OnInit} from "@angular/core";
import {CheckbookService} from "../services/checkbook-service";
import {Checkbook} from "../classes/checkbook";

@Component({
	/*selector: 'bar-chart-demo',*/
	templateUrl: "./templates/bar-template.php"
})

export class BarComponent implements OnInit {

	public barChartData: Array<any> = [];

	public barChartLabels: Array<any> = [];
	public barChartLabelsTemp: Array<any> = [];
	public flattenedLabelsArray: Array<any> = [];

	public barChartOptions:any = {
		scaleShowVerticalLines: false,
		responsive: true

	};

	constructor(private checkbookService: CheckbookService) {}

	ngOnInit(): void {
		this.getCheckbookByCheckbookVendor();
	}

	getCheckbookByCheckbookVendor(): void {
		this.checkbookService.getCheckbookByCheckbookVendor("building", 0)
			.subscribe(cityData => {
				let checkbooks : Checkbook[] = cityData;
				this.barChartData = [];
				this.barChartLabels = [];
				this.barChartLabelsTemp = [];
				this.flattenedLabelsArray = [];


				let vendors = checkbooks.map(checkbookEntry => checkbookEntry.checkbookVendor).filter((checkbookEntry, index, self) => self.indexOf(checkbookEntry) === index);

				for(let vendor of vendors) {
					let xAxis = checkbooks.filter(checkbookEntry => checkbookEntry.checkbookVendor === vendor).map(checkbookEntry => checkbookEntry.checkbookVendor);
					let yAxis = [checkbooks.filter(checkbookEntry => checkbookEntry.checkbookVendor === vendor).reduce((prevValue, checkbookEntry) => prevValue + checkbookEntry.checkbookInvoiceAmount, 0)];
					this.barChartData.push({data: yAxis, label: vendor});
					this.barChartLabelsTemp.push(xAxis);
					console.log(this.barChartData);
				}
				// console.log(this.barChartLabels);
				for(let labelgroup of this.barChartLabelsTemp) {
					for(let label of labelgroup){
						this.flattenedLabelsArray.sort().push(label);
					}
				}
				this.barChartLabels = Array.from(new Set(this.flattenedLabelsArray));
				this.barChartLabels = ["                                            "];

			});
	}

	public barChartLegend:boolean = true;
	public barChartType:string = "bar";

}
{'fraction_non_alphanumeric': 0.1314823313446535, 'fraction_numerical': 0.0006883891693437356, 'mean_word_length': 4.033487297921478, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7533869', 'n_tokens_mistral': 1456, 'n_tokens_neox': 1265, 'n_words': 234}