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

Y axis: define low and high point of data #86

Open
electricalessence opened this issue Nov 29, 2017 · 8 comments
Open

Y axis: define low and high point of data #86

electricalessence opened this issue Nov 29, 2017 · 8 comments

Comments

@electricalessence
Copy link

Hello guys! I hope you're all well,
I have an issue with the line chart.
Is there a way to define the Y axis lower value to 0, even thought the values entered are all in "100"?And is there a way to define the Y axis higher value to 100 aswell? How can I do that?

by the way, thank you for making this library, I love it!
Is there more documentation?

Thanks in advance,
Myr
*
g4

the datasets

    datasets: [
      {
        title: "Finiquito", color: "green",
        values: [100, 100, 100, 100, 100, 100]
      }
    ]

Here comes the whole code:



	  let linedatatest = {
	    labels: ["May", "Jun", "Jul", "Aug", "Sep", "Oct"],

	    datasets: [
	      {
	        title: "Finiquito", color: "green",
	        values: [0, 100, 100, 100, 100, 100]
	      }
	    ]
	    
	  };

	  let linecharttest = new Chart({
	    parent: "#linedatatest", // or a DOM element
	    title: "Linedata",
	    data: linedatatest,
	    type: 'line', // or 'line', 'scatter', 'pie', 'percentage'
	    width: 720,
	    height: 230,
	    format_tooltip_x: d => (d + '').toUpperCase(),
	    format_tooltip_y: d => d + ' pts'
	  });

Frappé Charts version: https://unpkg.com/[email protected]/dist/frappe-charts.min.iife.js

@rojakcoder
Copy link

I would love to know too. Can't find any documentation on this.

@rojakcoder
Copy link

My workaround is to put an empty y-marker.

let linedatatest = {
    labels: ["May", "Jun", "Jul", "Aug", "Sep", "Oct"],
    datasets: [
        {
            title: "Finiquito", color: "green",
            values: [0, 100, 100, 100, 100, 100]
        }
    ],
    yMarkers: [
        {
            label: '',
            value: 0,
            type: 'solid'
        }
    ]
};

It works for me.

@kepano
Copy link

kepano commented Apr 22, 2018

Being able to set the minimum, maximum and increment values for the Y axis would be very helpful. I think it would help solve this issue as well as #100 and #127.

@filipegeric
Copy link

This is definitively a needed feature. Is this something that will be implemented in the future?

@mansona
Copy link

mansona commented Dec 15, 2020

Hey if there is any guidance on how someone might approach this I might take a crack at it at some point 👍 I just ran across this issue myself where I don't want to have any increment less that a whole number (and also I want the minimum to always be at 0)

@mathiasbynens
Copy link

I think #264 can be closed as a duplicate of this issue.

@mansona Did you try the workaround in #86 (comment)?

@mansona
Copy link

mansona commented Jan 26, 2023

so It's been so long for me that I'm not sure which issue is referring to what any more 🙈 @mathiasbynens I looked at my code and it does seem to make sure that all graphs have a 0 in them if that's what you're hoping the workaround does

In my case I would love a way to properly influence the Y axis and make it not show 0.25 entries when my graph has a high number of 1 😞

@mansona
Copy link

mansona commented Jan 26, 2023

In fact I just solved my problem with an even worse workaround 🙈 I now have 2 yMarkers:

yMarkers: [
        {
            label: '',
            value: 0,
            type: 'solid'
        },
        {
          label: '',
          value: 5,
          type: 'solid'
        }
    ]

and that will prevent partial numbers from showing in the graph. And since I really don't have a need for numbers I'm just ignoring them always with CSS:

.frappe-chart .y-markers {
  display: none;
}

It's not a great solution, and you can't use it if you ever want to actually use markers but 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants