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

How can I enable tooltips for an igx-data-chart with a category X-axis and line series? #14789

Open
Vighneshaa opened this issue Sep 18, 2024 · 5 comments

Comments

@Vighneshaa
Copy link

I am using an igx-data-chart with a line series and a category X-axis. I would like to know if it's possible to display the tooltip, as shown in the screenshot, for this configuration. Specifically, I am looking for tooltip functionality similar to what is available for the igx-data-chart with a category X-axis and line series.

image

The code snippet is shown below:-
`<igx-data-chart domChange (onInit)="loadAxes(chart)" [crosshairVisibility]="crosshairVisibility" #chart
height="100%" width="100%" [legend]="legend" [defaultInteraction]="defaultInteraction"
[brushes]="brushColor" [isHorizontalZoomEnabled]="false" [isVerticalZoomEnabled]="false"
[dataSource]="chartData" highlightingMode="FadeOthersSpecific"
(plotAreaMouseLeftButtonDown)="chart_plotAreaMouseLeftButtonDown"
(seriesMouseLeftButtonDown)="chart_seriesMouseLeftButtonDown($event)"
highlightingBehavior="NearestItemsAndSeries">

                <igx-category-x-axis useClusteringMode="true" #xAxis [label]="xAxisLabel" overlap="0" gap="0.1">
                </igx-category-x-axis>

                <!-- (onInit)="seriesOnInit(lineSeries)" -->
                <igx-line-series [unknownValuePlotting]="unknownValuePlotting" #lineSeries
                    *ngFor="let axis of lineSeries" [xAxis]="xAxis" [yAxis]="yAxes[axis.template]"
                    [brush]="axis.lineColor" hitTestMode="ColorEncoded"
                    [markerType]="'None'" [valueMemberPath]="axis.title" [title]="axis.title" domChange
                    [thickness]="defaultThickness" showDefaultTooltip="true"
                    [isHighlightingEnabled]="true">
                </igx-line-series>
                
                <igx-data-tool-tip-layer></igx-data-tool-tip-layer>

                <!-- <igx-crosshair-layer brush="gray"></igx-crosshair-layer> -->

                <!-- <igx-final-value-layer></igx-final-value-layer> -->

            </igx-data-chart>`
@mddifilippo89
Copy link

Hello and thank you for reaching out. The sample above has showDefaultTooltip set to false because it's using the DataTooltipLayer.

eg.
https://codesandbox.io/p/devbox/busy-turing-sekw0r

After toggling showDefaultTooltip to false, if you are still having issues please make sure similar modules are loaded, especially the IgxDataChartInteractivityModule

see app.module.ts in the sample above. Let me know if you have any questions.

@Vighneshaa
Copy link
Author

@mddifilippo89
Hello I tried out the solution you suggested and it is not working.
Also, I have added the module IgxDataChartInteractivityModule in module.ts file

image

@Vighneshaa
Copy link
Author

@mddifilippo89 Any updates?

@mddifilippo89
Copy link

@Vighneshaa I will require a sample from you to investigate this further.

@Vighneshaa
Copy link
Author

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

2 participants