diff --git a/api/views.py b/api/views.py index b51cce1..4a326ac 100644 --- a/api/views.py +++ b/api/views.py @@ -142,7 +142,8 @@ def get_artist_data(request, user_secret): filter=Q(track__users=user))) processed_artist_counts = [{'name': artist.name, 'num_songs': artist.num_songs} for artist in artist_counts] - pprint(processed_artist_counts) + if CONSOLE_LOGGING: + pprint(processed_artist_counts) return JsonResponse(data=processed_artist_counts, safe=False) # }}} get_artist_data # @@ -207,8 +208,9 @@ def get_genre_data(request, user_secret): },... ] ''' - print("*** Genre Breakdown ***") - pprint(list(genre_counts)) + if CONSOLE_LOGGING: + print("*** Genre Breakdown ***") + pprint(list(genre_counts)) return JsonResponse(data=list(genre_counts), safe=False) # }}} get_genre_data # diff --git a/graphs/static/graphs/scripts/audio_feat_graph.js b/graphs/static/graphs/scripts/audio_feat_graph.js index f3bda24..45b9270 100644 --- a/graphs/static/graphs/scripts/audio_feat_graph.js +++ b/graphs/static/graphs/scripts/audio_feat_graph.js @@ -33,9 +33,9 @@ function drawAudioFeatGraph(audioFeature, intervalEndPoints, colId, userSecret) // featureData[key] = 0; // } // define the vertical scaling function - // let vScale = d3.scaleLinear().range([height, 0]); + let vScale = d3.scaleLinear().range([height, 0]); let padding = 0.5; - let vScale = d3.scaleLinear().range([100 - 2*padding, padding]); + // let vScale = d3.scaleLinear().range([100 - 2*padding, padding]); d3.json(`/api/audio_features/${audioFeature}/${userSecret}`) .then(function(response) { @@ -68,8 +68,8 @@ function drawAudioFeatGraph(audioFeature, intervalEndPoints, colId, userSecret) let hScale = d3.scaleBand() .domain(dataRanges) - // .rangeRound([0, width]) - .rangeRound([padding, 100 - 2*padding]) + .rangeRound([0, width]) + // .rangeRound([padding, 100 - 2*padding]) .padding(0.5); let xAxis = d3.axisBottom().scale(hScale); @@ -81,7 +81,7 @@ function drawAudioFeatGraph(audioFeature, intervalEndPoints, colId, userSecret) let featureGraph = featureSVG.append("g") .attr("transform", `translate(${margin.left}, ${margin.top})`) - .attr("fill", "teal"); + .attr("fill", "#0099CC"); featureGraph.selectAll(".bar") .data(dataArr) @@ -106,6 +106,7 @@ function drawAudioFeatGraph(audioFeature, intervalEndPoints, colId, userSecret) featureSVG.append("text") .attr('x', (width / 2)) .attr('y', (margin.top / 2)) + .attr('fill', "white") .attr('text-anchor', 'middle') .style('font-size', '14px') .text(`${capFeatureStr(audioFeature)}`); diff --git a/graphs/templates/graphs/artist_graph.html b/graphs/templates/graphs/artist_graph.html index 78a682c..e081639 100644 --- a/graphs/templates/graphs/artist_graph.html +++ b/graphs/templates/graphs/artist_graph.html @@ -1,9 +1,11 @@ {% load static %} +{% load sass_tags %} Artist Graphs + diff --git a/graphs/templates/graphs/features_graphs.html b/graphs/templates/graphs/features_graphs.html index 9eb30ee..477145d 100644 --- a/graphs/templates/graphs/features_graphs.html +++ b/graphs/templates/graphs/features_graphs.html @@ -1,4 +1,5 @@ {% load static %} +{% load sass_tags %} @@ -7,11 +8,10 @@ - User Spotify Data + Features Graphs - - +