Articles in this section
Category / Section

How to disable grid lines in pivot chart

2 mins read

This article explains how to disable gridlines in the Angular Pivot Chart.

Disable grid lines in pivot chart

In certain situations, you may want to remove the grid lines in a pivot chart to achieve a cleaner and less cluttered appearance. This can be done by setting the width of the majorGridLines property to 0 within the load event. Additionally, you can disable tick lines in the pivot chart by setting the width of the majorTickLines property to 0.

Here is a code snippet that guides how you can disable grid lines and tick lines:

[app.component.html]

<div class="control-section">
    <div>
        <ejs-pivotview #pivotview="" id="PivotView" [chartsettings]="chartSettings" [displayoption]="displayOption">
        </ejs-pivotview>
    </div>
</div>

[app.component.ts]

public displayOption: DisplayOption;
public chartSettings: ChartSettings;

@ViewChild('pivotview')
public pivotObj: PivotView;

onChartLoad(args: any) {
  for (let i = 0; i < args.chart.axes.length; i++) {
    //To disable the grid lines
    (this.pivotObj.chart as any).axes[i].majorGridLines = { width: 0 };
    //To disable the tick lines.
    (this.pivotObj.chart as any).axes[i].majorTickLines = { width: 0 };
  }
}

ngOnInit(): void {
  this.displayOption = { view: 'Chart' } as DisplayOption;
  this.chartSettings = {
    load: this.observable.subscribe(this.onChartLoad.bind(this)) as any,
  } as ChartSettings;
}

Screenshot:

grid-line.png

Refer to the working sample for additional details and implementation: Sample in Stackblitz

Conclusion:

We hope you enjoyed learning how to disable grid lines in the pivot chart.

You can refer to our Angular Pivot Table feature tour page to learn about its other groundbreaking feature representations and documentation, as well as how to quickly get started with configuration specifications. You can also explore our Angular Pivot Table example to understand how to create and manipulate data.

For current customers, you can check out our components on the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to explore our other controls. If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, BoldDesk Support, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied