xanderdeseyn / react-native-responsive-linechart

A customizable and responsive line or area chart for react-native
https://react-native-responsive-linechart.surge.sh
MIT License
205 stars 48 forks source link

Tooltip show two times #135

Open IKTANIM opened 2 years ago

IKTANIM commented 2 years ago

image

Tooltip show two times it should only one data at a time not all the nearest point data. Please fix this issue.

a-eid commented 2 years ago

make sure you have 1 tooltip component rendered.

IKTANIM commented 2 years ago

This issue occurs when I show two line graphs in one chart. How to render 1 tooltip when you have multiple line graphs on a single chart @a-eid ??

a-eid commented 2 years ago

I would add a description to give an idea of what is the behavior you think is best to handle this

timorss commented 5 months ago

Did u solve it?

I Need two tooltips as well.

When I press on one, the other popped up as well

timorss commented 5 months ago

i solved it by remove the tooltip from the second graph combining the two graph data together

and add new line with opacity zero

    {allPointsSorted.length > 0 && (
      <Line
        data={allPointsSorted}
        theme={{
          stroke: {
            width: 0,
            opacity: 0,   /////  <=======
            dashArray: [],
          },
          scatter: {
            default: {
              width: 8,
              height: 8,
              rx: 8,
              color: colors.skyBlue2,
            },
            selected: {
              width: 16,
              height: 16,
              rx: 16,
              color: colors.skyBlue2,
            },
          },
        }}
        tooltipComponent={
          <CustomTooltip
            showVerticalLineWithPopUp={showVerticalLineWithPopUp}
            visible={true}
            data={allPointsSorted}
            maxYDomain={maxYDomain}
          />
        }
      />
    )}