Skip to content

Commit 3454d58

Browse files
committed
fix geo json path and use dynamic value
1 parent 69e4dee commit 3454d58

File tree

2 files changed

+5
-6
lines changed
  • app/[locale]
    • (user)/datasets/[datasetIdentifier]/components/Details
    • dashboard/[entityType]/[entitySlug]/dataset/[id]/edit/charts/components

2 files changed

+5
-6
lines changed

app/[locale]/(user)/datasets/[datasetIdentifier]/components/Details/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { useRef } from 'react';
22
import Link from 'next/link';
33
import { useParams } from 'next/navigation';
4-
import assam_geojson from '@/app/[locale]/dashboard/[entityType]/[entitySlug]/dataset/[id]/edit/charts/components/data';
54
import { graphql } from '@/gql';
65
import { useQuery } from '@tanstack/react-query';
76
import ReactECharts from 'echarts-for-react';
@@ -20,6 +19,7 @@ import {
2019

2120
import { GraphQL } from '@/lib/api';
2221
import { Icons } from '@/components/icons';
22+
import assam_geojson from '@/geo_json/assam_geojson';
2323

2424
const charts = graphql(`
2525
query chartsData($datasetId: UUID!) {
@@ -62,7 +62,7 @@ const Details = () => {
6262
const renderChart = (item: any) => {
6363
if (item.chartType === 'ASSAM_DISTRICT') {
6464
// Register the map
65-
echarts.registerMap('assam_district', assam_geojson);
65+
echarts.registerMap(item.chartType.toLowerCase(), assam_geojson);
6666
}
6767

6868
return <ReactECharts option={item.chart} ref={chartRef} />;

app/[locale]/dashboard/[entityType]/[entitySlug]/dataset/[id]/edit/charts/components/ChartsVisualize.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import React, { useCallback, useEffect, useRef, useState } from 'react';
2-
3-
import * as echarts from 'echarts/core';
42
import { useParams } from 'next/navigation';
53
import { graphql } from '@/gql';
64
import {
@@ -10,6 +8,7 @@ import {
108
} from '@/gql/generated/graphql';
119
import { useMutation, useQuery } from '@tanstack/react-query';
1210
import ReactECharts from 'echarts-for-react';
11+
import * as echarts from 'echarts/core';
1312
import {
1413
Button,
1514
Checkbox,
@@ -25,7 +24,7 @@ import {
2524

2625
import { GraphQL } from '@/lib/api';
2726
import { Icons } from '@/components/icons';
28-
import assam_geojson from './data';
27+
import assam_geojson from '../../../../../../../../../../geo_json/assam_geojson';
2928

3029
interface VisualizationProps {
3130
setType: any;
@@ -222,7 +221,7 @@ const ChartsVisualize: React.FC<VisualizationProps> = ({
222221
}, [chartId, chartDetails]);
223222

224223
const updateChartData = (resourceChart: any) => {
225-
echarts.registerMap("assam_district", assam_geojson)
224+
echarts.registerMap(resourceChart.chartType.toLowerCase(), assam_geojson);
226225
const updatedData = {
227226
aggregateType: resourceChart.aggregateType as AggregateType,
228227
chartType: resourceChart.chartType as ChartTypes,

0 commit comments

Comments
 (0)