Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when I clicking on any of react in svg it is changing its color to green but i want red how can i do that? and how this panel color are working ? #121

Closed
pradeep800 opened this issue Jul 13, 2023 · 12 comments

Comments

@pradeep800
Copy link

No description provided.

@pradeep800 pradeep800 changed the title when I clicking on any of react in svg it is changing it color to green but i want red how can i do that? and how this panel color are working ? when I clicking on any of react in svg it is changing its color to green but i want red how can i do that? and how this panel color are working ? Jul 13, 2023
@jaywcjlove
Copy link
Member

&:active {
fill: #196127;
stroke-width: 0;
}

@pradeep800 You can write styles to set it.

@pradeep800
Copy link
Author

<HeatMap
            value={heatMapData?.[heatMapYears.indexOf(year)] ?? []}
            rectRender={(props, data) => {
              if (!data.count)
                return <rect className="active:fill-red-500" {...props} />;
              return (
                <Tooltip key={props.key} placement="top" content={data.content}>
                  <rect
                    className="active:fill-red-500 active:bg-red-500"
                    {...props}
                  />
                </Tooltip>
              );
            }}
            className="w-[700px] mx-auto"
            style={{ color: "#ad001d" }}
            startDate={new Date(`${year}/01/01`)}
            panelColors={{
              1: "#e4b293",
              2: "#d48462",
              4: "#c2533a",
              6: "#ad001d",
            }}
 />

it's not working
https://drive.google.com/file/d/10DBQcMcq5wK5iXsxn1o8eE7rfiEg4RzU/view?usp=sharing

@jaywcjlove
Copy link
Member

@pradeep800

  1. Updating to v2.1.0 can change this via css variables. Example: https://codesandbox.io/embed/https-github-com-uiwjs-react-heat-map-issues-121-example-02-t8gzzn?fontsize=14&hidenavigation=1&theme=dark
<HeatMap
  value={value}
  width={600}
  style={{
    "--rhm-rect": "#b9b9b9",
+    "--rhm-rect-active": "red"
  }}
  1. Can be overridden by styles before updating to v2.0.5. Example: https://codesandbox.io/embed/https-github-com-uiwjs-react-heat-map-issues-121-example-01-zr2p5p?fontsize=14&hidenavigation=1&theme=dark
svg.w-heatmap rect:active {
  fill: red;
}

@pradeep800
Copy link
Author

thank you for answering it is working correctly but I am getting error in production can you please help me that?
error photo: - https://drive.google.com/file/d/1WIkE-lTfc8rZcw3edFdm6s56TKv-ST8m/view?usp=sharing
code:- https://github.com/pradeep800/striver-sheet-webiste/blob/main/components/mainProfile.tsx#L84-L103 @jaywcjlove

@pradeep800
Copy link
Author

pradeep800 commented Jul 13, 2023

i am using next js 13*

@jaywcjlove
Copy link
Member

jaywcjlove commented Jul 13, 2023

@pradeep800 Upgrade v2.1.1 try it yourself?

    rectRender={(props, data) => {
      // if (!data.count) return <rect {...props} />;
      return (
-        <Tooltip key={props.key} placement="top" content={`count: ${data.count || 0}`}>
+        <Tooltip placement="top" content={`count: ${data.count || 0}`}>
          <rect {...props} />
        </Tooltip>
      );
    }}

@pradeep800
Copy link
Author

thank you for answering it is working correctly but I am getting error in production can you please help me that? error photo: - https://drive.google.com/file/d/1WIkE-lTfc8rZcw3edFdm6s56TKv-ST8m/view?usp=sharing code:- https://github.com/pradeep800/striver-sheet-webiste/blob/main/components/mainProfile.tsx#L84-L103 @jaywcjlove

still same error ?

@pradeep800
Copy link
Author

btw you can see code btw there is no error in production

@jaywcjlove
Copy link
Member

https://codesandbox.io/p/sandbox/strange-minsky-nvwz56

image

I'm not you this error, I can't run successfully.
@pradeep800

@jaywcjlove
Copy link
Member

image

@pradeep800 Oh my example works fine.

@pradeep800
Copy link
Author

pradeep800 commented Jul 13, 2023

use tooltip then it's giving error @jaywcjlove

@jaywcjlove
Copy link
Member

https://codesandbox.io/embed/sweet-aj-jpl6mx?fontsize=14&hidenavigation=1&theme=dark

import Tooltip from "@uiw/react-tooltip";
import HeatMap from "@uiw/react-heat-map";

const value = [
  { date: "2016/01/11", count: 2 },
  ...[...Array(17)].map((_, idx) => ({
    date: `2016/01/${idx + 10}`,
    count: idx
  })),
  ...[...Array(17)].map((_, idx) => ({
    date: `2016/02/${idx + 10}`,
    count: idx
  })),
  { date: "2016/04/12", count: 2 },
  { date: "2016/05/01", count: 5 },
  { date: "2016/05/02", count: 5 },
  { date: "2016/05/03", count: 1 },
  { date: "2016/05/04", count: 11 },
  { date: "2016/05/08", count: 32 }
];

export default function App() {
  return (
    <div>
      <HeatMap
        value={value}
        width={600}
        startDate={new Date("2016/01/01")}
        rectRender={(props, data) => {
          console.log("props", props);
          // if (!data.count) return <rect {...props} />;
          return (
            <Tooltip placement="top" content={`count: ${data.count || 0}`}>
              <rect {...props} />
            </Tooltip>
          );
        }}
      />
    </div>
  );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants