Skip to content

Commit

Permalink
render range in main stats
Browse files Browse the repository at this point in the history
  • Loading branch information
cesswairimu committed Feb 27, 2019
1 parent c74a0f3 commit 746a6fe
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 46 deletions.
47 changes: 1 addition & 46 deletions app/views/stats/_range.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,11 @@
<% end %>
<br>

<p><i>Member registration may include spam accounts</i></p>

<br>
<%# <div class="col-md-10"> %>
<div id="chart">
</div>
<p><i>Member registration may include spam accounts</i></p>
<br>
<%# </div> %>

Expand Down Expand Up @@ -212,47 +211,3 @@
<%# </div> %>
<%# </div> %>

<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<script>
var values = <%= @popular_tags.values %>;
var data = <%= raw (@popular_tags.keys) %>;

var options = {
chart: {
height: 400,
type: 'bar',

},
colors: ['#006dcc'],
plotOptions: {
bar: {
horizontal: false,

}

},

dataLabels: {
enabled: false

},
series: [{
name: 'Tag count',
data: values

}],
title:{
text: "Popular Tags in this period",
},
xaxis: {
categories: data

}

}

var chart = new ApexCharts(
document.querySelector("#chart"), options );
chart.render();

</script>
46 changes: 46 additions & 0 deletions app/views/stats/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<div class="container">

</div>
<div id="chart1"> </div>

<h3 align="center"> <u> Notes, Wikis and Comments Statistics in the past year </u></h3>
<br>
Expand Down Expand Up @@ -261,3 +262,48 @@ function generateWeekWiseTimeSeries(s, count) {
return series;
}
</script>

<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<script>
var values = <%= @popular_tags.values %>;
var data = <%= raw (@popular_tags.keys) %>;

var options = {
chart: {
height: 500,
type: 'bar',

},
colors: ['#006dcc'],
plotOptions: {
bar: {
horizontal: true,

}

},

dataLabels: {
enabled: false

},
series: [{
name: 'Tag count',
data: values

}],
title:{
text: "Popular Tags in this period",
},
xaxis: {
categories: data

}

}

var chart1 = new ApexCharts(
document.querySelector("#chart1"), options );
chart1.render();

</script>

0 comments on commit 746a6fe

Please sign in to comment.