Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Charts: Extract and expose ChartTooltip component  #42007

Open
@vovakulikov

Description

@vovakulikov

Related to https://github.com/sourcegraph/sourcegraph/issues/42006

Extract the Tooltip component and make it compoundable with the root Chart component or order to connect it with actions (focus, hover) in GroupedBars or StackedBars components

So the API at the end should be

function ConsumerChart() {
  const xScale =  scaleBand<string>({ domain: ['category1', 'category2', 'category3'], padding: 0.2 }),
  const yScale = scaleLinear<number>({ domain: [0, 100] })

  return (
     <Chart xScale={xScale} yScale={yScale}>
        <ChartAxisLeft {/* Any consumer specific props */}/>
        <ChartAxisBottom {/* Any consumer specific props */} /> 

        <ChartContent>
              { content => <AnyConsumerSpecificContent {/* Any consumer specific props */}/> }
        </ChartContent>

        <ChartTooltip {/* Any consumer specific props */} />
     </Chart>
  )
}

Why do we need to do it

Site admin page consumers had needs to make their own tooltip with custom content. This issue isn't first class problem in charts but since we're moving to small ui block and low level API in charts it makes sense to adjust TooltipComponent as well.

/cc @Joelkw @felixfbecker @vovakulikov

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions