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

Line chart full width #709

Open
cagataysayg opened this issue Oct 20, 2023 · 3 comments
Open

Line chart full width #709

cagataysayg opened this issue Oct 20, 2023 · 3 comments

Comments

@cagataysayg
Copy link

Hi im using line chart but i can't make it full width. I checked the element inspector there is no padding so it should be a width problem

IMG_1331

@laishere
Copy link

laishere commented Feb 10, 2024

You can modify the LineChart.tsx.

Check the point calculation logic here:

const x = (i: number) =>

You need to modify the x calculation logic, the straight way to do is changing the xmax calculations:

getXMaxValues = (data: Dataset[]) => {

From:

  getXMaxValues = (data: Dataset[]) => {
    return data.reduce((acc, cur) => {
      return cur.data.length > acc ? cur.data.length : acc;
    }, 0);
  };

To:

  getXMaxValues = (data: Dataset[]) => {
    const xmax = data.reduce((acc, cur) => {
      return cur.data.length > acc ? cur.data.length : acc;
    }, 0);
    return Math.max(1, xmax - 1);
  };

@cs-manughian
Copy link

You can modify the LineChart.tsx.

Check the point calculation logic here:

const x = (i: number) =>

You need to modify the x calculation logic, the straight way to do is changing the xmax calculations:

getXMaxValues = (data: Dataset[]) => {

From:

  getXMaxValues = (data: Dataset[]) => {
    return data.reduce((acc, cur) => {
      return cur.data.length > acc ? cur.data.length : acc;
    }, 0);
  };

To:

  getXMaxValues = (data: Dataset[]) => {
    const xmax = data.reduce((acc, cur) => {
      return cur.data.length > acc ? cur.data.length : acc;
    }, 0);
    return Math.max(1, xmax - 1);
  };

@laishere Thank you! Should we open a pull request?

@laishere
Copy link

laishere commented Jun 2, 2024

@cs-manughian You're welcome! Feel free to go ahead with the pull request.

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

3 participants