diff --git a/.editorconfig b/.editorconfig index f9f3187b7..d41b743d8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -19,7 +19,7 @@ tab_width=3 [*.js.map] indent_style=tab -indent_size=2 +indent_size=3 [{*.css,*.scss}] indent_style=space diff --git a/js/app/charts.js b/js/app/charts.js index 211f233a0..e73fe1edb 100644 --- a/js/app/charts.js +++ b/js/app/charts.js @@ -1,40 +1,85 @@ (function ($) { - $(document).ready(function () { + $(document).ready(function () { - $('[data-spark]').each(function () { - var $this = $(this), - data = $this.attr('data-spark'), - color = $this.attr('data-spark-color') || 'blue', - type = $this.attr('data-spark-type') || 'line'; + $().peity && $('[data-spark]').each(function () { + var $this = $(this), + data = $this.attr('data-spark'), + color = $this.attr('data-spark-color') || 'blue', + type = $this.attr('data-spark-type') || 'line'; - var $div = $('
').html(data); - $this.append($div); + var $div = $('').html(data); + $this.append($div); - var strokeColor = uikit.colors[color], - fillColor = uikit.colors[color]; + var strokeColor = tabler.colors[color], + fillColor = tabler.colors[color]; - if (type === 'donut' || type === 'pie') { - fillColor = [fillColor, uikit.hexToRgbA(fillColor, .1)]; - } else if (type === 'bar') { - fillColor = [fillColor]; - } else if (type === 'line') { - fillColor = uikit.hexToRgbA(fillColor, .1); - } + if (type === 'donut' || type === 'pie') { + fillColor = [fillColor, tabler.hexToRgbA(fillColor, .1)]; + } else if (type === 'bar') { + fillColor = [fillColor]; + } else if (type === 'line') { + fillColor = tabler.hexToRgbA(fillColor, .1); + } - $div.peity(type, { - width: $this.width(), - height: $this.height(), - // max: 100, - // min: 0, - stroke: strokeColor, - strokeWidth: 2, - fill: fillColor, - padding: .2, - innerRadius: (type === 'donut') ? 17 : 0 - }); + $div.peity(type, { + width: $this.width(), + height: $this.height(), + // max: 100, + // min: 0, + stroke: strokeColor, + strokeWidth: 2, + fill: fillColor, + padding: .2, + innerRadius: (type === 'donut') ? 17 : 0 + }); - }); - }); + + }); })(jQuery); + + +/* +Apexcharts default configuration + */ +if (window.Apex) { + Apex.grid = { + padding: { + right: 0, + left: 0 + } + }; + + Apex.dataLabels = { + enabled: false + }; + + Apex.plotOptions = { + pie: { + expandOnClick: false, + donut: { + size: '10%' + } + }, + }; + + Apex.chart = { + toolbar: { + show: false, + }, + animations: { + enabled: false, + } + }; + + Apex.stroke = { + width: 2, + curve: 'smooth', + }; + + Apex.fill = { + type: 'solid', + opacity: 1 + }; +} diff --git a/js/ui-kit.js b/js/ui-kit.js index 479964603..3c4658785 100644 --- a/js/ui-kit.js +++ b/js/ui-kit.js @@ -1,8 +1,7 @@ -var uikit = { +var tabler = { colorVariation: function (color, variation) { var colorValue = this.colors[color]; - if (colorValue) { switch (variation) { case 'light': @@ -112,4 +111,4 @@ $(document).ready(function () { }); }); -window.uikit = uikit; +window.tabler = tabler; diff --git a/pages/_data/charts.yml b/pages/_data/charts.yml index c0bf74f46..d4a68c98e 100644 --- a/pages/_data/charts.yml +++ b/pages/_data/charts.yml @@ -321,3 +321,18 @@ traffic-out: - name: Outbound color: red data: [3, 9, 7, 14, 4, 5, 9, 1, 7, 10, 14, 14, 2, 6] + +devices: + type: donut + sparkline: true + hide-legend: true + series: + - name: a + color: blue-dark + data: [23] + - name: b + color: blue + data: [54] + - name: c + color: blue-light + data: [34] diff --git a/pages/_includes/js/charts-heatmap.html b/pages/_includes/js/charts-heatmap.html index 27a2f19fc..5984e03e9 100644 --- a/pages/_includes/js/charts-heatmap.html +++ b/pages/_includes/js/charts-heatmap.html @@ -34,28 +34,28 @@ from: 0, to: 20, name: "Low", - color: uikit.colors.green + color: tabler.colors.green }, { from: 21, to: 50, name: "Medium", - color: uikit.colors.blue + color: tabler.colors.blue }, { from: 51, to: 75, name: "High", - color: uikit.colors.yellow + color: tabler.colors.yellow }, { from: 76, to: 100, name: "Extreme", - color: uikit.colors.red + color: tabler.colors.red }] } } }, {% else %} - colors: [{% if include.color %}'{{ include.color }}'{% else %}{% for color in site.colors limit: colors %}uikit.colors.{{ color[0] }}, {% endfor %}{% endif %}], + colors: [{% if include.color %}'{{ include.color }}'{% else %}{% for color in site.colors limit: colors %}tabler.colors.{{ color[0] }}, {% endfor %}{% endif %}], {% endif %} series: [ {% for i in site.months_short limit: 12 %} diff --git a/pages/_includes/js/charts.html b/pages/_includes/js/charts.html index cc4eb0595..61387537f 100644 --- a/pages/_includes/js/charts.html +++ b/pages/_includes/js/charts.html @@ -4,13 +4,10 @@ {% if data %} + - - - + + + {% if site.debug %} {% if jekyll.environment == 'development' %} @@ -19,7 +20,7 @@ diff --git a/pages/_plugins/jekyll-filters.rb b/pages/_plugins/jekyll-filters.rb index c54fa623d..4ce71ff09 100644 --- a/pages/_plugins/jekyll-filters.rb +++ b/pages/_plugins/jekyll-filters.rb @@ -67,6 +67,18 @@ module Jekyll value = value.gsub(/ class="feather[^"]+"/, '') value = value.gsub(/