<commit_before>﻿///<reference path="../references.ts" />

module SupportCenter {
    "use strict";

    export class DetectorViewHelper {

        constructor(private $window: angular.IWindowService) {
        }

        public GetChartOptions(detectorName: string = ''): any {

            var options: any = {
                chart: {
                    type: 'multiBarChart',
                    height: this.graphHeight,
                    margin: {
                        top: 20,
                        right: 20,
                        bottom: 50,
                        left: 60
                    },
                    color: this.defaultColors,
                    useInteractiveGuideline: true,
                    transitionDuration: 350,
                    showLegend: true,
                    stacked: true,
                    clipEdge: false,
                    showControls: false,
                    x: function (d) { return d.x; },
                    y: function (d) { return d.y; },
                    xAxis: {
                        showMaxMin: false,
                        axisLabel: 'Time (UTC)',
                        staggerLabels: true,
                        tickFormat: function (d) { return d3.time.format('%a %I %M %p')(new Date(d)); }
                    },
                    yAxis: {
                        axisLabel: '',
                        showMaxMin: false,
                        tickFormat: d3.format('.2f')
                    }
                }
            };

            switch (detectorName.toLowerCase()) {
                case 'runtimeavailability':
                case 'cpuanalysis':
                case 'memoryanalysis':
                    options.chart.type = 'lineChart';
                    break;
            }
            return options;
        }
        
        public GetChartData(startTimeStr: string, endTimeStr: string, metrics: DiagnosticMetricSet[], detectorName: string = ''): any {

            var self = this;
            var perWorkerGraph: boolean = false;
            
            var chartData = [];
            <commit_msg>use line charts for worker availability<commit_after>﻿///<reference path="../references.ts" />

module SupportCenter {
    "use strict";

    export class DetectorViewHelper {

        constructor(private $window: angular.IWindowService) {
        }

        public GetChartOptions(detectorName: string = ''): any {

            var options: any = {
                chart: {
                    type: 'multiBarChart',
                    height: this.graphHeight,
                    margin: {
                        top: 20,
                        right: 20,
                        bottom: 50,
                        left: 60
                    },
                    color: this.defaultColors,
                    useInteractiveGuideline: true,
                    transitionDuration: 350,
                    showLegend: true,
                    stacked: true,
                    clipEdge: false,
                    showControls: false,
                    x: function (d) { return d.x; },
                    y: function (d) { return d.y; },
                    xAxis: {
                        showMaxMin: false,
                        axisLabel: 'Time (UTC)',
                        staggerLabels: true,
                        tickFormat: function (d) { return d3.time.format('%a %I %M %p')(new Date(d)); }
                    },
                    yAxis: {
                        axisLabel: '',
                        showMaxMin: false,
                        tickFormat: d3.format('.2f')
                    }
                }
            };

            switch (detectorName.toLowerCase()) {
                case 'runtimeavailability':
                case 'cpuanalysis':
                case 'workeravailability':
                case 'memoryanalysis':
                    options.chart.type = 'lineChart';
                    break;
            }
            return options;
        }
        
        public GetChartData(startTimeStr: string, endTimeStr: string, metrics: DiagnosticMetricSet[], detectorName: string = ''): any {

            var self = this;
            var perWorkerGraph: boolean = false;
            
            var chartData = [];
            
{'fraction_non_alphanumeric': 0.09057215659022469, 'fraction_numerical': 0.006485985638174659, 'mean_word_length': 0.9807339449541285, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6950169', 'n_tokens_mistral': 1037, 'n_tokens_neox': 938, 'n_words': 231}