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
close icon

How can I change the zoom / pan icons to my defined icons?

Hello, we are currently using your sfchart for a graph and utilize the zoom pan icons on this chart. However I would like to change the pan icon from arrows to a hand. Can you please help me understand how to change out the icons for my own? 


3 Replies

MK Muneesh Kumar G Syncfusion Team August 2, 2019 07:11 AM UTC

Hi Brain, 
 
Greetings from Syncfusion.  
 
We have analyzed your requirement and we would like to inform you that we have support to customize the items display in the toolbar only. We don’t have support to customize the individual item’s icon and other options.  
 
Thanks,    
Muneesh Kumar G.   
 



BM Brian McCombs August 2, 2019 12:33 PM UTC

Ok, so can you think of some other ways I can do this. I see in some other controls that you have just simple commands to zoom, do these apply to the sfchart. So I can just make my own canvas with icons and then individually send the commands. Do you have any examples of this? 



MK Muneesh Kumar G Syncfusion Team August 2, 2019 01:32 PM UTC

Hi Brain,  
 
Greetings from Syncfusion.  
 
We have analyzed your requirement and we have achieved this by creating custom panel with zooming action buttons and performed the action for each button click as per the below code snippet.  
 
Code snippet 
 
  <chart:SfChart  Grid.Row="1" Margin="10" 
                       x:Name="chart" > 
            <chart:SfChart.Behaviors> 
                <chart:ChartZoomPanBehavior x:Name="zoom"/> 
            </chart:SfChart.Behaviors> 
             
            <chart:SfChart.PrimaryAxis> 
                <chart:NumericalAxis x:Name="xAxis" /> 
            </chart:SfChart.PrimaryAxis> 
             
            <chart:SfChart.SecondaryAxis> 
                <chart:NumericalAxis x:Name="yAxis" EdgeLabelsDrawingMode="Shift"> 
                </chart:NumericalAxis> 
            </chart:SfChart.SecondaryAxis> 
 
            <chart:ColumnSeries XBindingPath="XValue"  
                                Label="Series" 
                                YBindingPath="YValue" 
                             ItemsSource="{Binding Data}"/> 
 
        </chart:SfChart> 
        <StackPanel Orientation="Horizontal" Margin="10" 
                    Height="30" 
                    VerticalAlignment="Top" HorizontalAlignment="Right"> 
            <Button Content="ZoomIn" Margin="2" x:Name="zoomIn" Click="zoomIn_Click"/> 
            <Button Content="ZoomOut" Margin="2" x:Name="zoomOut" Click="zoomOut_Click"/> 
            <Button Content="Reset" Margin="2" x:Name="reset" Click="reset_Click"/> 
            <Button Content="Panning" Margin="2" x:Name="pan" Click="pan_Click"/> 
            <Button Content="Select Zoom" Margin="2" x:Name="select" Click="select_Click"/> 
        </StackPanel> 
 
 
private void zoomIn_Click(object sender, RoutedEventArgs e) 
        { 
            xAxis.ZoomFactor = xAxis.ZoomFactor - 0.2; 
            yAxis.ZoomFactor = yAxis.ZoomFactor - 0.2; 
        } 
 
        private void zoomOut_Click(object sender, RoutedEventArgs e) 
        { 
            xAxis.ZoomFactor = xAxis.ZoomFactor + 0.2; 
            yAxis.ZoomFactor = yAxis.ZoomFactor + 0.2; 
        } 
 
        private void pan_Click(object sender, RoutedEventArgs e) 
        { 
            zoom.EnablePanning = true; 
            zoom.EnableSelectionZooming = false; 
        } 
 
        private void select_Click(object sender, RoutedEventArgs e) 
        { 
            zoom.EnablePanning = false; 
            zoom.EnableSelectionZooming = true; 
        } 
 
        private void reset_Click(object sender, RoutedEventArgs e) 
        { 
            zoom.Reset(); 
        } 
    } 
 
We have prepared a sample based on this, please find the sample from the following location.  
 
 
You can modify the button contents as text or image based on your requirement.  
 
Screenshot:  
 
 
Please let us know if you have any other queries.  
 
Thanks,    
Muneesh Kumar G.    
 


Loader.
Live Chat Icon For mobile
Up arrow icon