chrismattmann commented on a change in pull request #135: Initial Commit of adding new UI designed with vue URL: https://github.com/apache/drat/pull/135#discussion_r202206852
########## File path: webapps/proteus-new/src/main/webapp/resources/src/components/barchartcomp.vue ########## @@ -0,0 +1,167 @@ +<template lang="html"> + + <section class="barchartcomp"> + <v-card id = "barchart"> + <h1>Liecense Breakdown</h1> + {{emptynote}}<br> + <svg id="barsvg" width="400" height="270"> + + </svg> + + </v-card> + </section> + +</template> + +<script lang="js"> +import * as d3 from 'd3'; +import axios from 'axios'; +import store from './../store/store' +// const props={ +// width:500, +// hieght:270 +// }; +// const graphData = [10,20,40,30]; + + + export default { + name: 'barchartcomp', + props: [], + store, + mounted() { + this.loadData(); + setInterval(function () { + this.loadData(); + }.bind(this), 1000); + + }, + data() { + return { + licenseTypes : [], + emptynote : '', + // licenseTypes : [{"type":"Binaries","numberOfObjects":139,"weight":0.40406976744186046},{"type":"Apache Licensed","numberOfObjects":96,"weight":0.27906976744186046},{"type":"Generated Documents","numberOfObjects":0,"weight":0.0},{"type":"Archives","numberOfObjects":0,"weight":0.0},{"type":"Notes","numberOfObjects":1,"weight":0.0029069767441860465},{"type":"Standards","numberOfObjects":108,"weight":0.313953488372093}] + // dts : [{letter:'A',frequency:0.9167},{letter:'B',frequency:0.4503},{letter:'C',frequency:0.4503}], + } + }, + watch:{ + + }, + methods: { + loadData(){ + // var config = { + // headers: {'Access-Control-Allow-Origin': '*'} + // }; + axios.get(this.origin+"/proteus/service/repo/breakdown/license") + .then(response=>{ + this.$log.info(response.data); + this.licenseTypes=response.data; + this.init(); + }) + .catch(error=>{ + this.emptynote = error.toString(); + throw error; + }) + // this.init(); + + }, + init(){ + + this.$log.info("c0"); + var svg = d3.select("#barsvg"), + margin = {top: 20, right: 20, bottom: 50, left: 40}, + width = +svg.attr("width") - margin.left - margin.right, + height = +svg.attr("height") - margin.top - margin.bottom; + + svg.selectAll("*").remove(); + + var x = d3.scaleBand().rangeRound([0, width]).padding(0.1), + y = d3.scaleLinear().rangeRound([height, 0]); + + var g = svg.append("g") + .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); + + + + var dataval = this.dts; + if(dataval.length!=0){ + this.emptynote=''; + //x.domain(d3.extent(dataval,function(d) { return d.letter; })); Review comment: commented code. Remove. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services