-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: 코드 리팩토링 (#316) * feat: 서비스 통계 페이지 (#316) * feat: 프론트 완성 (#316) * feat: 프론트 수정 (#316) * feat: 칼럼명 변경 (#316) * feat: 서비스 통계 (#316) * feat: 차트 옵션 (#316)
- Loading branch information
1 parent
05313f4
commit 87079b0
Showing
4 changed files
with
101 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
function drawChart() { | ||
const visitors = new google.visualization.DataTable(); | ||
visitors.addColumn('string', '날짜'); | ||
visitors.addColumn('number', '방문자 수'); | ||
visitors.addColumn({type:'number', role:'annotation'}) | ||
visitors.addRows(visitors_data); | ||
const chart = new google.visualization.ColumnChart(document.getElementById('chart_visitors')); | ||
chart.draw(visitors, options); | ||
|
||
const members = new google.visualization.DataTable(); | ||
members.addColumn('date', '날짜'); | ||
members.addColumn('number', '회원 수'); | ||
members.addRows(members_data); | ||
const charts = new google.visualization.LineChart(document.getElementById('chart_members')); | ||
charts.draw(members, options); | ||
|
||
window.addEventListener('resize', drawChart, false) | ||
} | ||
|
||
const options = { | ||
colors: ['rgb(1, 42, 127)'], | ||
vAxis: { | ||
minValue: 0 | ||
}, | ||
hAxis: { | ||
format: 'MMM yyyy', | ||
}, | ||
width: '100%', | ||
height: 400, | ||
}; | ||
|
||
google.charts.load('current', {'packages':['corechart', 'bar']}); | ||
google.charts.load('current', {packages: ['corechart', 'line']}); | ||
google.charts.setOnLoadCallback(drawChart); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{% extends 'base.html' %} | ||
{% load static %} | ||
{% block main_area %} | ||
<div class="container" style="margin-top: 4rem; margin-bottom: 4rem; text-align: center;"> | ||
<h2>총 회원 수</h2> | ||
<h2 style="color:var(--sangmyung);"><b>{{ user_total }}</b></h2> | ||
<div id="chart_members"></div> | ||
|
||
<h2 style="margin-top: 2rem;">총 방문자 수</h2> | ||
<h2 style="color:var(--sangmyung);"><b>{{ visit_total }}</b></h2> | ||
<div id="chart_visitors"></div> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block js %} | ||
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> | ||
<script type="text/javascript" src="{% static 'js/chart.js' %}"></script> | ||
<script type="text/javascript"> | ||
const data_member = {{ data_members|safe }}; | ||
const visitors_data = {{ data_visitors|safe }}; | ||
const members_data = data_member.map(x => [new Date(x[0]), x[1]]); | ||
</script> | ||
{% endblock %} |