Skip to content

Commit

Permalink
Migrate Plotly CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Mar 24, 2024
1 parent 1f55e54 commit f1ecd56
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 7 additions & 0 deletions panel/models/plotly.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type {StyleSheetLike} from "@bokehjs/core/dom"
import {div} from "@bokehjs/core/dom"
import type * as p from "@bokehjs/core/properties"
import {isPlainObject} from "@bokehjs/core/util/types"
Expand All @@ -10,6 +11,8 @@ import {deepCopy, get, reshape, throttle} from "./util"

import {HTMLBox, HTMLBoxView, set_size} from "./layout"

import plotly_css from "styles/models/plotly.css"

interface PlotlyHTMLElement extends HTMLDivElement {
_fullLayout: any
layout: any
Expand Down Expand Up @@ -181,6 +184,10 @@ export class PlotlyPlotView extends HTMLBoxView {
})
}

override stylesheets(): StyleSheetLike[] {
return [...super.stylesheets(), plotly_css]
}

override remove(): void {
if (this.container != null) {
(window as any).Plotly.purge(this.container)
Expand Down
7 changes: 1 addition & 6 deletions panel/pane/plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from __future__ import annotations

from typing import (
TYPE_CHECKING, Any, ClassVar, List, Mapping, Optional,
TYPE_CHECKING, Any, ClassVar, Mapping, Optional,
)

import numpy as np
Expand All @@ -14,7 +14,6 @@
from bokeh.models import ColumnDataSource
from pyviz_comms import JupyterComm

from ..io.resources import CDN_DIST
from ..util import isdatetime, lazy_load
from ..viewable import Layoutable
from .base import ModelPane
Expand Down Expand Up @@ -84,10 +83,6 @@ class Plotly(ModelPane):

priority: ClassVar[float | bool | None] = 0.8

_stylesheets: ClassVar[List[str]] = [
f'{CDN_DIST}css/plotly.css'
]

_updates: ClassVar[bool] = True

_rename: ClassVar[Mapping[str, str | None]] = {
Expand Down
File renamed without changes.

0 comments on commit f1ecd56

Please sign in to comment.