Explorar o código

hide the lagend from location list charts

Mohidul Islam %!s(int64=3) %!d(string=hai) anos
pai
achega
ae4ed5c19f
Modificáronse 2 ficheiros con 3 adicións e 6 borrados
  1. 3 1
      manager/templates/locations.html
  2. 0 5
      manager/views.py

+ 3 - 1
manager/templates/locations.html

@@ -162,6 +162,9 @@
         }]
         },
         options: {
+          legend: {
+              display: false,
+          },
           scales: {
               yAxes: [{
                   display: true,
@@ -174,7 +177,6 @@
                   ticks: {
                       beginAtZero: true,
                       stepSize: 1,
-                      max: data.max_rev_count
                   }
               }],
               xAxes: [{

+ 0 - 5
manager/views.py

@@ -255,7 +255,6 @@ class AllLocationSummary(APIView):
             return Response({'error': 'No location Found'}, status=status.HTTP_400_BAD_REQUEST)
         locations = Location.objects.all()
         review_counts = []
-        max_rev = 0
         for location in locations:
             loc_json = {
                 'name': location.care_name,
@@ -270,13 +269,9 @@ class AllLocationSummary(APIView):
                     location.last_week_neg_yelp_review_count
                 ]
             }
-            _temp_max = max(loc_json['positive']+loc_json['negative'])
-            if _temp_max > max_rev:
-                max_rev = _temp_max
             review_counts.append(loc_json)
         response = {
             'labels': ['Google', 'Facebook', 'Yelp'],
             'review_counts': review_counts,
-            'max_rev_count': max_rev,
         }
         return Response(response)