Skip to content

Commit

Permalink
opt: opt no data for crosshair label display
Browse files Browse the repository at this point in the history
  • Loading branch information
liihuu committed Apr 15, 2023
1 parent c627f1a commit b4e9ca2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/view/CrosshairHorizontalLabelView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class CrosshairHorizontalLabelView<C extends Axis = YAxis> extend
const chartStore = widget.getPane().getChart().getChartStore()
const crosshair = chartStore.getCrosshairStore().get()
const styles = chartStore.getStyles().crosshair
if (crosshair.paneId !== undefined && crosshair.kLineData !== undefined && this.checkPaneId(crosshair, pane.getId())) {
if (crosshair.paneId !== undefined && this.compare(crosshair, pane.getId())) {
if (styles.show) {
const directionStyles = this.getDirectionStyles(styles)
const textStyles = directionStyles.text
Expand All @@ -54,7 +54,7 @@ export default class CrosshairHorizontalLabelView<C extends Axis = YAxis> extend
}
}

protected checkPaneId (crosshair: Crosshair, paneId: string): boolean {
protected compare (crosshair: Crosshair, paneId: string): boolean {
return crosshair.paneId === paneId
}

Expand Down
4 changes: 2 additions & 2 deletions src/view/CrosshairVerticalLabelView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import CrosshairHorizontalLabelView from './CrosshairHorizontalLabelView'
import { TextAttrs } from '../extension/figure/text'

export default class CrosshairVerticalLabelView extends CrosshairHorizontalLabelView<XAxis> {
override checkPaneId (crosshair: Crosshair): boolean {
return crosshair.dataIndex === crosshair.realDataIndex
override compare (crosshair: Crosshair): boolean {
return crosshair.kLineData !== undefined && crosshair.dataIndex === crosshair.realDataIndex
}

override getDirectionStyles (styles: CrosshairStyle): CrosshairDirectionStyle {
Expand Down

0 comments on commit b4e9ca2

Please sign in to comment.