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

Set maximum value in radar chart #32

Open
EdaDeniz opened this issue Jan 21, 2021 · 3 comments
Open

Set maximum value in radar chart #32

EdaDeniz opened this issue Jan 21, 2021 · 3 comments
Labels
question Further information is requested

Comments

@EdaDeniz
Copy link

I use this library for my react project. I need a radar chart. When I implement it, It displays the maximum value in my data as the last limit in the graph.
image
For example in this chart, my maximum value is 2. and the end of the chart is 2. but I want to set a default value as 5. Five circular lines I mean.

For another example my values is 3,2,4 out of 5 so I want to show chart max value is 5.

my code:

const datam = value.map(a => ({key: a.title, data: a.value}));
	    <RadialAreaChart
                                data={datam}
                                height={350}
                                width={350}

                                valueToPercent={249}
                                axis={<RadialAxis type="category"/>}
                            />
@erdouzun
Copy link

any solution for this?

@amcdnl
Copy link
Member

amcdnl commented Jan 22, 2021

In order to customize the chart, you need to implement the series component. This is how I have done it in the past:

<ChartContainer
  id={id}
  width={width}
  height={height}
  margins={margins}
  xAxisVisible={false}
  yAxisVisible={false}
  center={true}
>
  <RadialAreaSeries
    id={`radar-area-${id}`}
    data={data}
    xScale={xScale}
    yScale={yScale}
    height={height}
    width={width}
    outerRadius={outerRadius}
    innerRadius={innerRadius}
  />
</ChartContainer>

I would be open to accepting a PR to set the min/max similar to what I allowed for the LinearGauage chart like:

/**
   * Min value to scale on. Only applicable for single-series.
   */
  minValue: number;

  /**
   * Max value to scale on. Only applicable for single-series.
   */
  maxValue: number;

Which is implemented like this: https://github.com/reaviz/reaviz/blob/master/src/LinearGauge/LinearGauge.tsx#L72. That code would be implemented somewhere in here: https://github.com/reaviz/reaviz/blob/master/src/RadialAreaChart/RadialAreaChart.tsx#L59

@erdouzun
Copy link

Thx for the reply @amcdnl

@amcdnl amcdnl added the question Further information is requested label Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants