|
| 1 | +/** |
| 2 | +* @license |
| 3 | +* Copyright 2021, JsData. All rights reserved. |
| 4 | +* |
| 5 | +* This source code is licensed under the MIT license found in the |
| 6 | +* LICENSE file in the root directory of this source tree. |
| 7 | +
|
| 8 | +* Unless required by applicable law or agreed to in writing, software |
| 9 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +* See the License for the specific language governing permissions and |
| 12 | +* limitations under the License. |
| 13 | +* ========================================================================== |
| 14 | +*/ |
| 15 | +import { linePlot } from "./plotly/index"; |
| 16 | +import Series from "../core/series"; |
| 17 | +import DataFrame from "../core/frame"; |
| 18 | +import { PlotConfigObject } from "../shared/types"; |
| 19 | + |
| 20 | +class Plotly { |
| 21 | + divId: string; |
| 22 | + ndframe: DataFrame | Series; |
| 23 | + |
| 24 | + constructor(ndframe: DataFrame | Series, divId: string) { |
| 25 | + this.ndframe = ndframe; |
| 26 | + this.divId = divId; |
| 27 | + } |
| 28 | + |
| 29 | + /** |
| 30 | + * Plot Series or DataFrame as lines. |
| 31 | + * Uses the Plotly as backend, so supoorts Plotly's configuration parameters |
| 32 | + * @param plotConfig configuration options for making Plots, supports Plotly.js parameters. |
| 33 | + */ |
| 34 | + line(plotConfig: PlotConfigObject) { |
| 35 | + linePlot(this.ndframe, this.divId, plotConfig); |
| 36 | + } |
| 37 | + |
| 38 | + |
| 39 | +} |
| 40 | + |
| 41 | +export { |
| 42 | + Plotly |
| 43 | +} |
0 commit comments