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

Is chart can be in scaffold state?(swipable along X-axis)? #36

Open
josephraj2k16 opened this issue Sep 19, 2019 · 0 comments
Open

Is chart can be in scaffold state?(swipable along X-axis)? #36

josephraj2k16 opened this issue Sep 19, 2019 · 0 comments

Comments

@josephraj2k16
Copy link

josephraj2k16 commented Sep 19, 2019

HI,I have imported sparkline chart in my project,and the X-axis is aligning according to the number of data available(if there are 3 data,the spacing between them is equal,but if there are more data x-axis is overlapping).So,is there possibility to make the spacing between the data in x-axis constant and make all other data to be swipable horizontally as in scaffold state??...

I'm attaching the code and image of the one i explained above..

Screenshot_1568882862

code for above pic is..

////---->below is the code for data.
`const cities = [
const City("May 14", Level.Not, 4,3),
const City("May 15", Level.Kinda, 4,4),
const City("May 16", Level.Quite, 4,3),
const City("May 17", Level.Quite, 4,2),
const City("May 18", Level.Quite, 4,1),
const City("May 19", Level.Quite, 4,3),
const City("May 20", Level.Quite, 4,4),

//const City("Palo Alto", Level.Very, 5),
];`

///--->below is the code for graph

` final xAxis = new ChartAxis();

return new AspectRatio(
  aspectRatio: 4 / 3,
  child: new LineChart(
    chartPadding: new EdgeInsets.fromLTRB(60.0, 20.0, 40.0, 30.0),
    lines: [
      new Line<City, String, int>(
        data: cities,
        xFn: (city) => city.name,
        yFn: (city) => city.size,
        xAxis: xAxis,
        yAxis: new ChartAxis(
          span: new IntSpan(0, 6),
          tickGenerator: IntervalTickGenerator.byN(1),
          paint: const PaintOptions.stroke(color: Colors.blue),
          tickLabelerStyle: new TextStyle(color: Colors.blue, fontWeight: FontWeight.bold),
        ),
        marker: const MarkerOptions(
          paint: const PaintOptions.fill(color: Colors.blue),
          shape: MarkerShapes.square,
        ),
        stroke: const PaintOptions.stroke(color: Colors.blue),
        legend: new LegendItem(
          paint: const PaintOptions.fill(color: Colors.blue),
          text: 'Ideal',
        ),
      ),
      new Line<City, String, int>(
        data: cities,
        xFn: (city) => city.name,
        yFn: (city) => city.size1,
        xAxis: xAxis,
        yAxis: new ChartAxis(
          span: new IntSpan(0, 6),
          tickGenerator: IntervalTickGenerator.byN(1),
          paint: const PaintOptions.stroke(color: Colors.green),
          tickLabelerStyle: new TextStyle(color: Colors.green, fontWeight: FontWeight.bold),
        ),
        marker: const MarkerOptions(
          paint: const PaintOptions.fill(color: Colors.green),
          shape: MarkerShapes.square,
        ),
        stroke: const PaintOptions.stroke(color: Colors.green),
        legend: new LegendItem(
          paint: const PaintOptions.fill(color: Colors.green),
          text: 'Actual',
        ),
      ),
     
    ],
  ),
);`
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

1 participant