antvis / G2Plot

:dango: An interactive and responsive charting library based on G2.
https://g2plot.antv.antgroup.com
MIT License
2.55k stars 605 forks source link

πŸ€” [QUESTION] Unable to customize the label of X axis. (Radar Chart) #3795

Open IlIIIIIIlI opened 2 months ago

IlIIIIIIlI commented 2 months ago

πŸ› Question description

I want to add a border for the label of X axis in the Radar Chart

πŸ’» Link to minimal reproduction

      xAxis: {
        label: {
          style: {
            fontFamily: "'Inter', sans-serif",
            fontWeight: 500,
            fontSize: 20,
            fill: "#0C0D21",
            border: "1px solid #F1F1F7",
            background: "#6a6a6a",
            className: styles.xAxisLabel,
          },
          formatter: (text, item, index) => {
            const userAScore = data.find(
              (d) => d.item === text && d.user === "User A"
            ).actualScore;
            const userBScore = data.find(
              (d) => d.item === text && d.user === "User B"
            ).actualScore;
            return `${text} (A: ${userAScore}, B: ${userBScore})`;
          },
          useHtml: true,
          htmlTemplate: (text) => `
            <div style="
              background: #FFFFFF;
              border: 1px solid #F1F1F7;
              border-radius: 4px;
              padding: 4px 8px;
            ">${text}</div>
          `,
        },
.xAxisLabel {
  border: 3px solid #000 !important;
  padding: 2px;
  background-color: #fff;
}

🏞 Expected result

I tried add border using HTML or using className to define. but all failed. I checked the doc, but I did not find an example to support this. if this is achievable?

deerLoves commented 2 months ago

We also encountered a similar problem, want to increase the two cycle comparison date, x axis hope to support custom components

IlIIIIIIlI commented 2 months ago

We also encountered a similar problem, want to increase the two cycle comparison date, x axis hope to support custom components

I used chart.js instead. try it.