Merge branch 'feature/point_chart_fixes' into 'dev'

point chart fixes

See merge request spatial/postamates_frontend!54
dev
Anton Vlasov 2 years ago
commit 5355bf0ea6

@ -67,6 +67,24 @@ export const PointChart = ({ point }) => {
plugins: { plugins: {
legend: { legend: {
display: false display: false
},
tooltip: {
displayColors: false,
callbacks: {
label: function(context) {
const label = []
const shap_key = Object.keys(GRAPH_LABELS_MAP).find(key => GRAPH_LABELS_MAP[key] === context.label);
const key = shap_key.substring(0, shap_key.length - 5)
label.push("Значение: \n" + point[key]);
if (context.parsed.x !== null) {
label.push("Вклад в прогноз, %: " + context.parsed.x);
}
return label;
},
body: () => {
return "Вклад в прогноз, %:"
}
}
} }
}, },
scales: { scales: {
@ -78,11 +96,12 @@ export const PointChart = ({ point }) => {
} }
} }
}; };
const labels = Object.keys(GRAPH_LABELS_MAP).sort((a, b) => { const labels = Object.keys(GRAPH_LABELS_MAP).sort((a, b) => {
if (Math.abs(point[a]) < Math.abs(point[b])) return 1; if (Math.abs(point[a]) < Math.abs(point[b])) return 1;
else return -1; else return -1;
}).slice(0, 15); }).slice(0, 15);
labels.map((l) => console.log(l, point[l]))
const data = { const data = {
labels: labels.map((l) => GRAPH_LABELS_MAP[l]), labels: labels.map((l) => GRAPH_LABELS_MAP[l]),
datasets: [ datasets: [

@ -1,6 +1,6 @@
export const PanoramaIcon = ({ width = 24, height = 24 }) => { export const PanoramaIcon = ({ width = 24, height = 24 }) => {
return ( return (
<svg xmlns="http://www.w3.org/2000/svg" className="rounded-md bg-[#cc2222] p-1" width={width} height={height} viewBox="0 0 24 24"> <svg xmlns="http://www.w3.org/2000/svg" className="rounded-md bg-[#cc2222] hover:bg-[#d94c48] p-1" width={width} height={height} viewBox="0 0 24 24">
<path <path
fillRule="evenodd" fillRule="evenodd"
clipRule="evenodd" clipRule="evenodd"

@ -41,9 +41,7 @@ export const TableSettings = ({orderColumns}) => {
<div className="flex flex-col" {...provided.droppableProps} ref={provided.innerRef}> <div className="flex flex-col" {...provided.droppableProps} ref={provided.innerRef}>
{columnsList.map((item, index) => { {columnsList.map((item, index) => {
const num = item.position; const num = item.position;
console.log(num, item);
if (!orderColumns.defaultColumns[num]) return; if (!orderColumns.defaultColumns[num]) return;
console.log(num, item);
return ( return (
<Draggable key={`list-${num}`} draggableId={`list-${num}`} index={index}> <Draggable key={`list-${num}`} draggableId={`list-${num}`} index={index}>
{(provided) => ( {(provided) => (

@ -7,6 +7,7 @@ import { AddressSearch } from "../../Map/AddressSearch.jsx";
import { SearchOutlined } from "@ant-design/icons"; import { SearchOutlined } from "@ant-design/icons";
import { useTable } from "../../stores/useTable.js"; import { useTable } from "../../stores/useTable.js";
import useLocalStorage from "../../hooks/useLocalStorage.js"; import useLocalStorage from "../../hooks/useLocalStorage.js";
import { TrafficModal } from "../../Map/TrafficModal.jsx";
export const useColumns = (fields = [], key) => { export const useColumns = (fields = [], key) => {
const { data: regions } = useGetRegions(); const { data: regions } = useGetRegions();
const { const {
@ -103,6 +104,7 @@ export const useColumns = (fields = [], key) => {
ellipsis: true, ellipsis: true,
sorter: true, sorter: true,
showSorterTooltip: false, showSorterTooltip: false,
render: (_, record) => <TrafficModal point={record} />
}, },
{ {
title: "Кол-во подъездов в жилом доме", title: "Кол-во подъездов в жилом доме",

Loading…
Cancel
Save