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

Can't seem to find a way to use an auto scale axis #17

Open
jvanderberg opened this issue Jun 15, 2015 · 4 comments
Open

Can't seem to find a way to use an auto scale axis #17

jvanderberg opened this issue Jun 15, 2015 · 4 comments

Comments

@jvanderberg
Copy link

I looked at the API docs for regular version of chartist, and the method of selecting an autoscale x axis doesn't appear to be available in the wrapper. Inspecting the source code, it seems that a chart is created by default with a numeric y axis and a stepped x axis, with no means of overriding that.

Am I missing something here? If not, at there plans to expose the different axis types via the react wrapper?

@mivade
Copy link

mivade commented Oct 26, 2015

I'm having this issue, too. Specifically, I am doing the following:

return (
    <ChartistGraph data={chartData}
        options={{
            axisX: {
                type: Chartist.AutoScaleAxis,
                onlyInteger: false
            }
        }}
        type={'Line'} />
);

This is in line with the examples in the documentation.

@Cisneiros
Copy link

Same issue here. Is this being maintained?

@qoalu
Copy link

qoalu commented Apr 19, 2017

I am setting the scale with this shortcut
options{ high: Math.max( ...array ) }

with array being the series values, if you have two series Math.max( [...array, ...array2] ) should work

@ngoue
Copy link

ngoue commented Dec 9, 2020

This package is not a wrapper around the original chartist package. It is just a component wrapper that knows what HTML to spit out for charts. chartist is the package you're looking for and it is a dependency of this project. That's where you can access all the options. Import the chartist package and use it thusly:

import React from 'react'
import Chartist from 'chartist'
import ChartistGraph from 'react-chartist'

function MyChart(props) {
  return (
    <ChartistGraph
      type='Line'
      data={props.data}
      options={{
        axisX: {
          type: Chartist.AutoScaleAxis,
          onlyInteger: true
        }
      }}
    />
  )
}

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

5 participants