f5 / unovis

Modular data visualization framework for React, Angular, Svelte, Vue, and vanilla TypeScript or JavaScript
https://unovis.dev
Apache License 2.0
2.23k stars 43 forks source link

Getting empty graphs when x values are strings #305

Closed kwarc-star closed 6 months ago

kwarc-star commented 11 months ago

I am getting empty graphs whenever my x values are string. Tried with stacked line and stacked bar charts. They work fine if the values are number/date. Am I missing anything?

<VisBulletLegend items={legendItems} />
  <VisXYContainer data={chartData} height={"50vh"}>
  <VisTooltip triggers={triggers} />
  <VisGroupedBar
    x={useCallback((d) => d.x, [])}
    y={headers.map((header) =>
      useCallback((d) => d[header.name], [])
    )}
  />
</VisXYContainer>

When d.x outputs number or date, it works fine.

rokotyan commented 11 months ago

@kwarc-star Bar charts in Unovis don't support string values. If you want to create an ordinal bar chart, you can refer to this section from our documentation: https://unovis.dev/docs/guides/tips-and-tricks/#displaying-ordinal-values

deekshithmr95 commented 3 weeks ago

can you provide the working stackblitz example?