How to remove space between WPF Toolkit chart area and plot area?

后端 未结 2 1205
再見小時候
再見小時候 2021-02-13 20:45

I am using chartingToolKit:Chart control. I want to remove the white space appear in between the chart and plot area. Attached the WPF sample and image of area to be removed.

2条回答
  •  -上瘾入骨i
    2021-02-13 21:30

    In order to achieve this you need to re-template the chart. The standard chart template is as follows:

                
                    
                        
                            
                                
                                
                            
    
                            
    
                            
                            
                                
                                    
                                    
                                
    
                                
                                
                                    
                                    
                                
                            
                        
                    
                
    

    This details the location of the plot area, title, legend etc... It also included a hard-coded margin around the plot area, so you cannot achieve what you are after by simply styling the chart. If you just want a chart area and nothing else, you can simplify the chart template as follows:

    xmlns:chartingprimitives="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    
    
      
        
        
        
          
          
          
        
        
          
            
              
                
                  
                  
                
              
            
          
        
      
    
    

    This will remove the padding that you are seeing.

提交回复
热议问题