mirror of
https://github.com/usetrmnl/plugins.git
synced 2026-08-13 14:26:58 -07:00
43 lines
2.0 KiB
ERB
43 lines
2.0 KiB
ERB
<script src="https://code.highcharts.com/highcharts.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/chartkick@5.0.1/dist/chartkick.min.js"></script>
|
|
|
|
<div class="view view--half_horizontal">
|
|
<div class="layout layout--row gap--space-between">
|
|
<div class="grid h-full">
|
|
<div class="col--span-1 h-full">
|
|
<div class="col gap--space-between">
|
|
<% metrics.first(3).each_with_index do |(metric, value), index| %>
|
|
<div class="item">
|
|
<div class="meta"></div>
|
|
<div class="content">
|
|
<span class="value value--small"><%= format_number(value) %></span>
|
|
<span class="label label--small"><%= metric.to_s.titleize %></span>
|
|
</div>
|
|
</div>
|
|
<% if index < metrics.first(3).size - 1 %>
|
|
<div class="w-full b-h-gray-5"></div>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col--span-4 col h-full gap--space-between">
|
|
<% formatted_data = histogram.map { |period| [period[:date], period[:pageviews]] } %>
|
|
<%= line_chart formatted_data, adapter: :highcharts, prefix: "", thousands: ",", points: false, colors: ["black"], curve: true,
|
|
library: {
|
|
chart: { height: 176, width: 612 },
|
|
plotOptions: { series: { animation: false, lineWidth: 4 } },
|
|
yAxis: { labels: { style: { fontSize: '16px', color: '#000000' } }, gridLineDashStyle: 'shortdot', gridLineWidth: 1, gridLineColor: '#000000', tickAmount: 5 },
|
|
xAxis: { type: 'daytime', labels: { enabled: false }, lineWidth: 0, gridLineDashStyle: 'dot', tickWidth: 1, tickLength: 0, gridLineWidth: 1, gridLineColor: '#000000', tickPixelInterval: 120 }
|
|
}
|
|
%>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="title_bar title_bar--small">
|
|
<img class="image" src="<%= Rails.application.credentials.base_url %>/images/plugins/google-analytics--render.svg" />
|
|
<span class="title">Google Analytics</span>
|
|
<span class="instance"><%= instance_name %></span>
|
|
</div>
|
|
</div> |