Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
Use plotly-dist instead of plotly (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuali925 authored Dec 2, 2020
1 parent 4ac98c9 commit 34dc9ff
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3,069 deletions.
4 changes: 2 additions & 2 deletions gantt-chart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"test:cypress": "cypress run"
},
"dependencies": {
"plotly.js": "^1.54.1",
"plotly.js-dist": "^1.57.1",
"react-plotly.js": "^2.4.0"
},
"devDependencies": {
"cypress": "^5.0.0",
"@types/react-plotly.js": "^2.2.4",
"cypress": "^5.0.0",
"eslint": "^6.8.0"
},
"engines": {
Expand Down
8 changes: 5 additions & 3 deletions gantt-chart/public/components/gantt_chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

import _ from 'lodash';
import moment from 'moment';
import { PlotData } from 'plotly.js';
import React, { Fragment, useEffect } from 'react';
import Plot from 'react-plotly.js';
import plotComponentFactory from "react-plotly.js/factory";
import Plotly, { PlotData } from "plotly.js-dist";
import { EuiEmptyPrompt, EuiText } from '@elastic/eui';
import { UiSettingsClient } from 'src/core/public/ui_settings';
import { ExprVis } from 'src/plugins/visualizations/public';
Expand All @@ -35,6 +35,8 @@ export function GanttChart({
visData: GanttSuccessResponse;
visParams: GanttParams;
}) {
const PlotComponent = plotComponentFactory(Plotly);

const getGanttData = (): { data: PlotData[], tickvals: number[], ticktext: string[], yLabels: string[], yTexts: string[] } => {
const source: any[] = visData.source;
const data: PlotData[] = [];
Expand Down Expand Up @@ -134,7 +136,7 @@ export function GanttChart({
return (
<>
{visParams.labelField && visParams.startTimeField && visParams.durationField && ganttData.data.length > 0 ? (
<Plot
<PlotComponent
divId="plotly-gantt-chart"
data={ganttData.data}
style={{ width: '100%', height: '100%' }}
Expand Down
Loading

0 comments on commit 34dc9ff

Please sign in to comment.