react-d3 / react-d3-basic

Basic d3 charts in React.js, only include: line, bar, pie, scatter, area charts.
http://reactd3.org/docs/basic
221 stars 117 forks source link

BarGroupChart : X tick label is not centered #46

Open aesteve opened 7 years ago

aesteve commented 7 years ago

As a very minimal reproducer :

import React, {Component} from 'react';
import { BarGroupChart } from 'react-d3-basic';

export default () => {
    const data = [{age: 10, populationHere: 50, populationThere: 75}, {age: 20, populationHere: 100, populationThere: 95}, {age: 30, populationHere: 120, populationThere: 65}];
    const chartSeries = [{field: "populationHere", name: "Population Here", color: 'red'}, {field: "populationThere", name: "Population There", color: 'blue'}];
    const x = d => d.age;
    return (
        <BarGroupChart
            width={1000}
            height={200}
            x={x}
            chartSeries={chartSeries}
            xScale="ordinal"
            xLabel="Population"
            showYGrid={false}
            showXGrid={false}
            data={data} />
    );
};

image

As you can see on the picture above, the label is not displayed in between the two bars, but abit too much to the right.

Are you aware of that ? Is this on purpose ? Can I change this behaviour somehow ?

Thanks for your help.