We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Linear Gauge OnGuageMouseDown to get which LinearGaugeRange is clicked.

<SfLinearGauge ID="GaugeThree" @ref="GaugeThree" Orientation="Syncfusion.Blazor.LinearGauge.Orientation.Horizontal" Background="transparent" AllowMargin="false" Width="100%" Height="100%">
            <LinearGaugeMargin Left="0" Right="0" Top="0" Bottom="0"></LinearGaugeMargin>
            <LinearGaugeBorder Color="#FF0000" Width="2"></LinearGaugeBorder>
            <LinearGaugeEvents OnGaugeMouseDown="MouseDown"></LinearGaugeEvents>
            <LinearGaugeContainer Type="ContainerType.RoundedRectangle">
                <LinearGaugeContainerBorder Width="0"></LinearGaugeContainerBorder>
                <LinearGaugeAxes>
                    <LinearGaugeAxis Minimum="1000" Maximum="500000">
                        <LinearGaugeLine Width="0" />
                        <LinearGaugeMajorTicks Interval="50000" Height="0" />
                        <LinearGaugeMinorTicks Interval="0" Height="0" />
                        <LinearGaugeAxisLabelStyle>
                            <LinearGaugeAxisLabelFont Size="0"></LinearGaugeAxisLabelFont>
                        </LinearGaugeAxisLabelStyle>
                        <LinearGaugePointers>
                            <LinearGaugePointer Width="0"/>
                        </LinearGaugePointers>
                        <LinearGaugeRanges>
                            <LinearGaugeRange Start="3000" End="14000" StartWidth="45" EndWidth="45" Color="#FF0000" Offset="0" />
                            <LinearGaugeRange Start="31000" End="44000" StartWidth="45" EndWidth="45" Color="#0000FF" Offset="0" />
                            <LinearGaugeRange Start="160000" End="290000" StartWidth="45" EndWidth="45" Color="#00FF00" Offset="0" />
                        </LinearGaugeRanges>
                    </LinearGaugeAxis>
                </LinearGaugeAxes>
            </LinearGaugeContainer>
        </SfLinearGauge>


Is it possible to get the LinearGaugeRange that is under the mouse on a OnGaugeMouseDown happens? Currently the

Syncfusion.Blazor.LinearGauge.MouseEventArgs X and Y values seem to be the pixel X,Y on the screen.


Thanks.


5 Replies 1 reply marked as answer

IR Indumathi Ravi Syncfusion Team March 31, 2023 11:55 AM UTC

Hi Jeff,


We do not currently support returning details in the Linear Gauge using the "OnGaugeMouseDown" event, whether the range is clicked or not. We have considered your requirement as an improvement and added it to our features request list.  However, we will include this implementation in our 2023 Volume 2 release which is expected to be available by the end of June 2023. Meanwhile, please find the feedback link below to keep track of this improvement.


https://www.syncfusion.com/feedback/42557


Marked as answer

IR Indumathi Ravi Syncfusion Team April 12, 2023 05:55 PM UTC

Hi Jeff,


In general, we do not provide the entire class object (LinearGaugeRange) as a property value in the event argument when an event is defined in the Blazor component (SfLinearGauge). To identify the range that has been clicked, we normally provide the index value of the range and the axis. However, these index values cannot be used to change the range element's attributes such as color, border, and so on. Could you please tell us about your exact requirement in retrieving the range details in the “OnGaugeMouseDown” event? It will be helpful for us to analyze and assist you further.



JB Jeff Baxter replied to Indumathi Ravi April 13, 2023 02:37 PM UTC

It would be useful to get the index value of the each of the Ranges on the Linear Gauge. I just wanted to get access to the Start and End values of the Ranges themselves.


Thanks,

jeff



IR Indumathi Ravi Syncfusion Team April 14, 2023 09:49 AM UTC

Hi Jeff,


Thank you for the update.


We'll let you know once the package is published.



IR Indumathi Ravi Syncfusion Team June 22, 2023 12:15 PM UTC

Hi Jeff,


We have implemented the feature - “Support to identify which Linear Gauge range is clicked via OnGaugeMouseDown event” and the implementation is included in our Essential Studio 2023 Volume 2 Main Release v22.1.34 which is rolled out and is available for download under the following link.


Essential Studio 2023 Volume 2 Main Release v22.1.34 is available for download | Announcements Forums | Syncfusion


Now, you can get the index value of ranges from the “RangeIndex” property in the event argument of the “OnGaugeMouseDown” event when clicked on the Linear Gauge. Please find the code snippet for the same below.


Code Snippet:

<SfLinearGauge ID="GaugeThree" @ref="GaugeThree" >

   //..

    <LinearGaugeEvents OnGaugeMouseDown="MouseDown"></LinearGaugeEvents>

    <LinearGaugeContainer Type="ContainerType.RoundedRectangle">

        <LinearGaugeAxes>

            <LinearGaugeAxis Minimum="1000" Maximum="500000">

               //..

                <LinearGaugeRanges>

                    <LinearGaugeRange Start="3000" End="14000" StartWidth="45" EndWidth="45" Color="#FF0000" Offset="0" />

                 //..

                </LinearGaugeRanges>

            </LinearGaugeAxis>

        </LinearGaugeAxes>

    </LinearGaugeContainer>

</SfLinearGauge>

@code{

      public void MouseDown(Syncfusion.Blazor.LinearGauge.MouseEventArgs args)

      {

        Console.WriteLine(args.RangeIndex);

      }

}


Please find the sample and video for demonstration from the below link.

Samplehttps://www.syncfusion.com/downloads/support/directtrac/general/ze/LinearGauge1292492323

Video - https://www.syncfusion.com/downloads/support/directtrac/general/ze/linear-665625359


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you require any further assistance.


Loader.
Live Chat Icon For mobile
Up arrow icon