Crosshair with only vertical line

1 Answer 165 Views
Charts
Megan
Top achievements
Rank 1
Iron
Iron
Megan asked on 26 Aug 2022, 07:03 PM

I have a categorical line chart with multiple series, and I want the crosshair to only display a vertical line and work like a shared tooltip, with markers for all the lines showing up on the crosshair.

 

I found a picture online that matches what I want exactly (except for having no tooltip/text), and it belongs to Kendo UI for Angular, but the search result just takes me to the main page, so I have no idea how to accomplish this... I've attached the image I found.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimiter Topalov
Telerik team
answered on 31 Aug 2022, 08:22 AM

Hi Megan,

To provide crosshair for one axis only, the developer can use the respective axis configuration object or nested configuration element (as Kendo Charts provide two configuration concepts):

https://www.telerik.com/kendo-angular-ui/components/charts/chart/configuration/

One possible approach is to use theCategoryAxisCrosshair component and either provide input option for the "tooltip" settings, or nest another component - the CategoryAxisCrosshairTooltip component:

<kendo-chart-category-axis>
            <kendo-chart-category-axis-item
                [categories]="['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul']"
                [title]="{ text: 'Months' }">
                <kendo-chart-category-axis-item-crosshair>
                  <kendo-chart-category-axis-item-crosshair-tooltip>
                  </kendo-chart-category-axis-item-crosshair-tooltip>
            </kendo-chart-category-axis-item-crosshair>
            </kendo-chart-category-axis-item>
        </kendo-chart-category-axis>

Here is a runnable demo that demonstrates the described approach:

https://stackblitz.com/edit/angular-h4hd5t?file=src%2Fapp%2Fapp.component.ts

I hope this helps.

Regards,


Dimiter Topalov
Progress Telerik

The Premier Dev Conference is back! 

Coming to you live from Progress360 in-person or on your own time, DevReach for all. Register Today.


Megan
Top achievements
Rank 1
Iron
Iron
commented on 01 Sep 2022, 01:18 PM

That's exactly what I was looking for, thank you!
Tags
Charts
Asked by
Megan
Top achievements
Rank 1
Iron
Iron
Answers by
Dimiter Topalov
Telerik team
Share this question
or