This is a migrated thread and some comments may be shown as answers.

Horizontal and Vertical lines

3 Answers 1139 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Fairoz
Top achievements
Rank 1
Fairoz asked on 04 Mar 2021, 02:13 AM

Is it possible to draw  vertical or horizontal lines on the chart?, to display as limits? I could not find any examples of it. Its just for user to check if the series data are within the limits set. 

 

Thanks

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 04 Mar 2021, 06:30 AM

Hi,

The horizontal line is relatively easy - a line series with y-values that all have the same (desired) value, we have one such in the Date Axis demo.

Vertical lines, however, are a more complex. Generally, if your first series is a Bar series, the chart will flip the x and y axes visually (it will rotate 90 degrees) and line charts will be vertical now. I am not sure this is what you are after, I expect you want some sort of marker in a certain place in the x-axis that goes up to denote a certain value or threshold. If so, keep reading for some more ideas.

What could help a lot in this case is actually the ColorField feature some series have - it lets you change the color of the given bar/column per item in the series. So, you could evaluate the data and set the value of that field to a new color if it matches certain criteria (say, it is below a target value).

In our Kendo charts, there are two features that might help in creating thresholds - Notes (see example here too that is closer to what I think you may be seeking) and plot bands. You can also find a few other ideas that are possible in our older suites that have some more features here (including the plot bands approach). If you like either of them, we can open a feature request so that it gets implemented in Blazor too, so you can know when it becomes available.

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Fairoz
Top achievements
Rank 1
answered on 18 Mar 2021, 08:11 AM

Hi Marin,

Thanks for getting back with those suggestions. And yes, those horizontal and vertical lines were supposed to be markers, limits & threshold. Would be awesome if there was a way to simply draw a horizontal and vertical lines, bound to a collection of y and x data respectively.

I think this would be a feature request and hoping for something like the below would be nice.,

 

    <TelerikChart>
        <ChartSeriesItems>
            <ChartSeries Type="@ChartSeriesType.Line" Name="@P_Name1" Color="blue"
                         Data="@P_Data1"
                         Field="@P_Field1"
                         CategoryField="@P_CategoryField1">
                <ChartSeriesLabels Visible="true" Template="#=dataItem.P_Description#" />
                <ChartSeriesMarkers Size="4" />
            </ChartSeries>
            <ChartHorizontalLines Data="@YLinesData"/>
            <ChartVerticalLines Data="@XLinesData"/>
        </ChartSeriesItems>
</TelerikChart>

@code{

List<double> YLinesData, XLinesData;

}

 

0
Marin Bratanov
Telerik team
answered on 18 Mar 2021, 03:20 PM

Hi,

I made this feature request page on your behalf so you can monitor the status of such a feature: https://feedback.telerik.com/blazor/1511761-easy-to-draw-horizontal-and-vertical-lines-in-the-charts. I also think it would be nice, and if there is interest in the community for it, management will consider its implementation.

 

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Charts
Asked by
Fairoz
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Fairoz
Top achievements
Rank 1
Share this question
or