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

Grid Alignment #158

Closed
andresumanzor opened this issue Oct 11, 2018 · 2 comments
Closed

Grid Alignment #158

andresumanzor opened this issue Oct 11, 2018 · 2 comments

Comments

@andresumanzor
Copy link

andresumanzor commented Oct 11, 2018

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Access to a prop which would allow users to select if the grid would be either aligned regarding the X or Y axis.

Describe alternatives you've considered
The grid not to start halfway before the first point on the X Axis

Additional context
Sample Options Code (This was mind for a Spline Chart so, don't mind the extra color values on the colors attribute):

var options = {
  chart: {
    height: 380,
    type: "area"
  },
  series: [
    {
      name: "Series 1",
      data: [45, 52, 38, 45, 19, 23, 2]
    }
  ],
  xaxis: {
    categories: [
      "01 Jan",
      "02 Jan",
      "03 Jan",
      "04 Jan",
      "05 Jan",
      "06 Jan",
      "07 Jan"
    ]
  },
  dataLabels: {
        enabled: false
    },
    stroke: {
        show: true,
        curve: 'smooth',
        lineCap: 'butt',
        colors: undefined,
        width: 2,
        dashArray: 0,
    },
    markers: {
        size: 3,
        colors: undefined,
        strokeColor: '#fff',
        strokeWidth: 2,
        strokeOpacity: 0.9,
        fillOpacity: 1,
        shape: "circle",
        radius: 2,
        offsetX: 0,
        offsetY: 0,
        hover: {
            size: 4
        }
    },
    fill: {
        colors: undefined,
        opacity: 0.4,
        type: 'solid',
    },
    grid: {
        show: true,
        borderColor: '#dcdcdc',
        strokeDashArray: 0,
        position: 'back',
        clipMarkers: true,
        xaxis: {
            lines: {
                show: true,
                offsetX: '0.5',
                offsetY: '0.5'
            }
        },
    },
    colors: ["#90c695", "#6aa894", "#f47d54", "#7d6cb7", "#104c6d", "#e08283", "#fba969", "#50bccd", "#cc6050"]
};

Screenshot:
image 2018-10-11 at 11 30 18 am

Thank you!

@junedchhipa
Copy link
Contributor

junedchhipa commented Oct 11, 2018

In category x-axis chart, the left and right padding cannot be removed easily.

You can try xaxis.type = 'datetime' along with
grid.padding.left = 0 and
grid.padding.right = 0

Your updated demo: https://codepen.io/junedchhipa/pen/XxgeKE
screen shot 2018-10-11 at 11 17 15 pm

Also, I didn't understand your point "if the grid would be either aligned regarding the X or Y axis." Could you elaborate, please?

@andresumanzor
Copy link
Author

Thank you @junedchhipa, it works like a charm!

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

2 participants