Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Revert "added new circle chart for panels"

Blue Mouse8151fb03b3f8
diff --git a/src/pages/Project/View/Panels.jsx b/src/pages/Project/View/Panels.jsx
index 2c784eaf7..cc36e3b09 100644
--- a/src/pages/Project/View/Panels.jsx
+++ b/src/pages/Project/View/Panels.jsx
@@ -1,6 +1,6 @@
import React, { memo, useState, useEffect, useMemo, Fragment } from 'react'
import { ArrowSmUpIcon, ArrowSmDownIcon } from '@heroicons/react/solid'
-import { FilterIcon, MapIcon, ViewListIcon, ArrowsExpandIcon, ChartPieIcon } from '@heroicons/react/outline'
+import { FilterIcon, MapIcon, ViewListIcon, ArrowsExpandIcon } from '@heroicons/react/outline'
import cx from 'clsx'
import PropTypes from 'prop-types'
import _keys from 'lodash/keys'
@@ -18,8 +18,6 @@ import Progress from 'ui/Progress'
import PulsatingCircle from 'ui/icons/PulsatingCircle'
import Modal from 'ui/Modal'
import { iconClassName } from './ViewProject'
-import {pie} from "billboard.js"
-import Chart from 'ui/Chart'
const ENTRIES_PER_PANEL = 5
@@ -65,27 +63,6 @@ const PanelContainer = ({
/>
</div>
)}
- { type !== "cc" &&
- type &&
- type !== "me" &&
- type !== "ca" && (
- <div className='flex'>
- <ViewListIcon
- className={cx(iconClassName, 'cursor-pointer', {
- 'text-blue-500': activeFragment === 0,
- 'text-gray-900 dark:text-gray-50': activeFragment === 1,
- })}
- onClick={() => setActiveFragment(0)}
- />
- <ChartPieIcon
- className={cx(iconClassName, 'ml-2 cursor-pointer', {
- 'text-blue-500': activeFragment === 1,
- 'text-gray-900 dark:text-gray-50': activeFragment === 0,
- })}
- onClick={() => setActiveFragment(1)}
- />
- </div>
- )}
</div>
<div className='flex flex-col h-full scroll-auto'>
{children}
@@ -288,7 +265,6 @@ const Panel = ({
const keysToDisplay = useMemo(() => _slice(keys, currentIndex, currentIndex + 5), [keys, currentIndex])
const total = useMemo(() => _reduce(keys, (prev, curr) => prev + data[curr], 0), [keys]) // eslint-disable-line
const [activeFragment, setActiveFragment] = useState(0)
- const [chartOptions, setChartOptions] = useState({})
const [modal, setModal] = useState(false)
const canGoPrev = () => page > 0
const canGoNext = () => page < _floor(_size(keys) / ENTRIES_PER_PANEL)
@@ -303,21 +279,6 @@ const Panel = ({
}
}, [currentIndex, keys])
- useEffect(() => {
- if (!_isEmpty(data)) {
- setChartOptions({
- data: {
- columns: _map(data, (e, index) => [index, e]),
- type: pie(),
- onclick: (item) => { _onFilter(id, item.id)}
- },
- legend: {
- show: false,
- },
- })
- }
- }, [data])
-
const onPrevious = () => {
if (canGoPrev()) {
setPage(page - 1)
@@ -330,8 +291,6 @@ const Panel = ({
}
}
-
-
if (id === 'cc' && activeFragment === 1 && !_isEmpty(data)) {
return (
<PanelContainer
@@ -364,29 +323,6 @@ const Panel = ({
)
}
- if (activeFragment === 1 && !_isEmpty(data)) {
- return (
- <PanelContainer
- name={name}
- icon={icon}
- type={id}
- setActiveFragment={setActiveFragment}
- activeFragment={activeFragment}
- >
- {_isEmpty(data) ? (
- <p className="mt-1 text-base text-gray-700 dark:text-gray-300">
- {t("project.noParamData")}
- </p>
- ) : (
- <Chart
- options={chartOptions}
- current={`Panels-${id}`}
- />
- )}
- </PanelContainer>
- );
- }
-
return (
<PanelContainer name={name} icon={icon} type={id} activeFragment={activeFragment} setActiveFragment={setActiveFragment}>
{_isEmpty(data) ? (
@@ -500,4 +436,4 @@ export {
PanelMemo as Panel,
OverviewMemo as Overview,
CustomEventsMemo as CustomEvents,
-}
+}
\ No newline at end of file
diff --git a/src/ui/Chart.jsx b/src/ui/Chart.jsx
deleted file mode 100644
index ba20b4120..000000000
--- a/src/ui/Chart.jsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import React, { useEffect } from "react";
-import bb from "billboard.js";
-import "billboard.js/dist/theme/datalab.css"
-import "billboard.js/dist/billboard.css";
-
-const Chart = ({current, children, options}) => {
- let chartInstance = {};
-
- useEffect(() => {
- renderChart()
-
- return () => { destroy() }
- })
-
- const destroy = () => {
- if (chartInstance !== null) {
- try {
- chartInstance.destroy();
- } catch (error) {
- console.error("Internal billboard.js error", error);
- } finally {
- chartInstance = null;
- }
- }
- }
-
- const renderChart = () => {
- if (current !== null) {
- chartInstance = bb.generate({
- ...options,
- bindto: "#"+ current
- });
- }
- }
-
-
- return (
- <div>
- <div id={current} />
- {children}
- </div>
- );
-
-}
-
-export default Chart