Skip to content

Commit

Permalink
Version 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeFourkas committed Oct 27, 2023
1 parent c1d750b commit 753f2ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 6 additions & 5 deletions stubs/resources/js/admin/charts/chart-colors.config.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
export function chartConfigs() {
return {
traffic: {
border: "rgb(191,61,171)",
border: "rgb(59, 130, 246)",
gradient: [
{
offset: 1,
color: "rgba(203,12,159,0.2)",
color: "rgba(59, 130, 246, 0.2)",
},
{
offset: 0.2,
color: "rgba(72,72,176,0.0)",
color: "rgba(59, 130, 246, 0.15)",
},
{
offset: 0,
color: "rgba(203,12,159,0)",
color: "rgba(59, 130, 246, 0.0)",
}
]
},
map: {
color: "rgb(191,61,171)"
color: "rgb(59, 130, 246)",
hoverColor: "#9ca3af"
}
}
}
4 changes: 3 additions & 1 deletion stubs/resources/js/admin/charts/modules/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {Chart} from "chart.js";
import {chartConfigs} from "../chart-colors.config";

export function drawMapChart(response) {
const chartColorRgb = chartConfigs().map.color;
const chartColorRgb = chartConfigs()?.map?.color;
const hoverColor = chartConfigs()?.map?.hoverColor;
const analyticsData = response;
fetch('https://unpkg.com/world-atlas/countries-50m.json').then((r) => r.json()).then((data) => {
const countries = ChartGeo.topojson.feature(data, data.objects.countries).features;
Expand Down Expand Up @@ -31,6 +32,7 @@ export function drawMapChart(response) {
label: 'Countries',
data: finalData,
borderColor: 'rgb(229,231,235)',
hoverBackgroundColor: hoverColor,
backgroundColor: finalData.map((item) => {
if (item.value > 0 && Number(item.value / maxUsers).toFixed(1) < 0.05) {
return rgbToRgba(chartColorRgb, 0.05)
Expand Down

0 comments on commit 753f2ed

Please sign in to comment.