Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #9667 Longitudinal profile chart is not visible anymore #9668

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions web/client/components/charts/WidgetChart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -651,13 +651,15 @@ export const toPlotly = (_props) => {
*/
function WidgetChart({
onInitialized,
onHover,
...props
}) {
const { data, layout, config } = toPlotly(props);
return (
<Suspense fallback={<LoadingView />}>
<Plot
onInitialized={onInitialized}
onHover={onHover}
data={data.flat()}
layout={layout}
config={config}
Expand Down
65 changes: 0 additions & 65 deletions web/client/plugins/longitudinalProfile/Chart.jsx

This file was deleted.

50 changes: 31 additions & 19 deletions web/client/plugins/longitudinalProfile/Dock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import tooltip from "../../components/misc/enhancers/tooltip";
import LoadingView from "../../components/misc/LoadingView";
import ResponsivePanel from "../../components/misc/panels/ResponsivePanel";
import Toolbar from "../../components/misc/toolbar/Toolbar";
import Chart from "./Chart";
import Chart from "../../components/charts/WidgetChart";

const NavItemT = tooltip(NavItem);

Expand Down Expand Up @@ -74,23 +74,36 @@ const ChartData = ({
}
}, [marker]);

const series = [{dataKey: "altitude", color: `#078aa3`}];
const xAxis = {dataKey: "distance", show: false, showgrid: true};
const options = {
xAxisAngle: 0,
yAxis: true,
yAxisLabel: messages.longitudinalProfile.elevation,
traces: [{
id: 'longitudinal-profile-trace',
type: 'line',
style: {
line: {
color: `#078aa3`
}
},
options: {
groupByAttributes: 'distance',
aggregationAttribute: 'altitude'
}
}],
xAxisOpts: [{
id: 0,
angle: 0,
hide: false,
title: messages.longitudinalProfile.distance,
fontSize: 11
}],
yAxisOpts: [{
id: 0,
title: messages.longitudinalProfile.elevation,
tickSuffix: ' m',
hide: false,
fontSize: 11
}],
legend: false,
tooltip: false,
cartesian: true,
popup: false,
xAxisOpts: {
hide: false
},
yAxisOpts: {
tickSuffix: ' m'
},
xAxisLabel: messages.longitudinalProfile.distance
cartesian: true
};

const generateChartImageUrl = () => {
Expand Down Expand Up @@ -144,9 +157,8 @@ const ChartData = ({
{...options}
height={maximized ? height - 115 : 400}
width={maximized ? width - (dockStyle?.right ?? 0) - (dockStyle?.left ?? 0) : 520 }
data={data}
series={series}
xAxis={xAxis}
// using multiple traces data is array of arrays of data
data={[data]}
/>
{config.referential && projection ? <table className="data-used">
<tr>
Expand Down