Skip to content

Commit

Permalink
fixed the time graph
Browse files Browse the repository at this point in the history
  • Loading branch information
GanadiniAkshay committed Nov 25, 2017
1 parent bdf2137 commit 2551e44
Show file tree
Hide file tree
Showing 204 changed files with 38,270 additions and 20 deletions.
68 changes: 52 additions & 16 deletions client/components/analytics/analyticsPage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import Chart from 'chart.js';
import moment from 'moment';
import { connect } from 'react-redux';

import { getLogs } from '../../actions/analyticsActions';
Expand Down Expand Up @@ -47,29 +48,49 @@ class AnalyticsPage extends React.Component{
intent_count.push(count[key]);
}

console.log(intent_labels);
that.setState({api_calls:logs.calls,time:logs.avg_resp_time,intent_count:intent_count,intent_labels:intent_labels,success:logs.success_percentage, times: logs.times});


var timestamp_labels = [];
var timestamp_data = [];
var timestamps = [];
var times = that.state.times;

times.sort(function(a,b){ return (new Date(a)-new Date(b))});

var timestamp_info = {};

for (var i=0; i<times.length; i++){
var time_obj = {}
time_obj['x'] = new Date(times[i]);
time_obj['y'] = 1
timestamp_data.push(time_obj);
var date_obj = new Date(times[i]);
var date = date_obj.getDate();
var month = date_obj.getMonth();
var year = date_obj.getFullYear();
var new_date_obj = new Date(year,month-1,date);
var key = new_date_obj.toDateString();
if (timestamp_info[key] != undefined){
timestamp_info[key] += 1;
}else{
timestamp_info[key] = 1;
}
}

for (var key in timestamp_info){
timestamp_data.push(timestamp_info[key]);
timestamp_labels.push(new Date(key));
}

function newDate(days) {
return moment().add(days, 'd');
}

var data = {
labels: timestamp_labels,
datasets: [{
label: 'No of API Requests',
data: timestamp_data,
borderColor: '#00008B',
backgroundColor: 'transparent'
},

]
}]
};

var ctx = document.getElementById("timeChart");
Expand All @@ -79,24 +100,39 @@ class AnalyticsPage extends React.Component{
options: {
fill: 'origin',
responsive: true,

elements: {
line: {
tension: 0
}
},
scales: {
xAxes: [{
type: 'time',
time: {
displayFormats: {
'millisecond': 'MMM DD',
'second': 'MMM DD',
'minute': 'MMM DD',
'hour': 'MMM DD',
'day': 'MMM DD',
'week': 'MMM DD',
'month': 'MMM DD',
'quarter': 'MMM DD',
'year': 'MMM DD',
}
},
display: true,
scaleLabel: {
display: true,
labelString: "Date",
}
}],

yAxes: [{
display: true,
scaleLabel: {
display: true,
labelString: "Calls",
}
}]
scaleIntegersOnly: true,
ticks: {
beginAtZero: true
}
}]
}
},
});
Expand Down
4 changes: 2 additions & 2 deletions client/components/persona/personaPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class PersonaPage extends React.Component{
<div className="switch">
<label>
No
<input disabled type="checkbox" checked={this.state.average} onChange={this.changeAverage}/>
<input type="checkbox" checked={this.state.average} onChange={this.changeAverage}/>
<span className="lever"></span>
Yes
</label>
Expand All @@ -140,7 +140,7 @@ class PersonaPage extends React.Component{
<div className="switch">
<label>
No
<input disabled type="checkbox" checked={this.state.professional} onChange={this.changeProfessional}/>
<input type="checkbox" checked={this.state.professional} onChange={this.changeProfessional}/>
<span className="lever"></span>
Yes
</label>
Expand Down
2 changes: 1 addition & 1 deletion releases/release.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version" : "0.8.4"
"version" : "0.8.6"
}
95 changes: 95 additions & 0 deletions releases/v0.8.5/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
html, body {
max-width: 100%;
height:100%;
overflow-x: hidden;
}

#app{
height:100%
}

a {
color: inherit;
}

a:hover {
color: inherit;
text-decoration: none;
}

.ctas-button:hover{
color:black;
text-decoration: none;
}

/* label focus color */
.input-field input[type=text]:focus + label {
color: #000;
}

.input-field input[type=email]:focus + label {
color: #000;
}

.input-field input[type=password]:focus + label {
color: #000;
}

textarea.materialize-textarea:focus:not([readonly]) + label {
color: #000;
}

/* label underline focus color */
.input-field input[type=text]:focus {
border-bottom: 1px solid #ABA0CB;
box-shadow: 0 1px 0 0 #ABA0CB;
}

.input-field input[type=email]:focus {
border-bottom: 1px solid #ABA0CB;
box-shadow: 0 1px 0 0 #ABA0CB;
}

.input-field input[type=password]:focus {
border-bottom: 1px solid #ABA0CB;
box-shadow: 0 1px 0 0 #ABA0CB;
}

textarea.materialize-textarea:focus:not([readonly]) {
border-bottom: 1px solid #ABA0CB;
box-shadow: 0 1px 0 0 #ABA0CB;
}

header, main, footer {
padding-left: 240px;
}

@media only screen and (max-width : 992px) {
header, main, footer {
padding-left: 0;
}
}

.side-nav a:hover{
color:#ABA0CB
}

.side-nav .collapsible-body>ul:not(.collapsible)>li.active, .side-nav.fixed .collapsible-body>ul:not(.collapsible)>li.active {
background-color: #ABA0CB;
}

.dropdown-content li > a, .dropdown-content li > span {
color: #ABA0CB;
}

main{
height: 100%
}

.full{
height: 100%
}

.ozz_color{
background: #ABA0CB;
}
54 changes: 54 additions & 0 deletions releases/v0.8.5/css/devices.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2551e44

Please sign in to comment.