Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3674318
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:50:25+00:00 2026-05-19T02:50:25+00:00

I am using chartingToolKit:Chart control. I want to remove the white space appear in

  • 0

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.

<Window x:Class="WpfApplication2.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525" xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit">


<Grid>
    <chartingToolkit:Chart x:Name="chart" Width="500" Height="300" Margin="0, 0, 0, 0"   LegendStyle="{StaticResource LegendStyle}"   >


        <chartingToolkit:AreaSeries ItemsSource="{Binding}"  

                                   DependentValuePath="Value"

                                   IndependentValuePath="Key"

                                   Background="Red"

                                    >


        </chartingToolkit:AreaSeries>

        <chartingToolkit:Chart.Axes>
            <chartingToolkit:LinearAxis Orientation="X" ShowGridLines="False" Visibility="Hidden">

            </chartingToolkit:LinearAxis>
            <chartingToolkit:LinearAxis Orientation="Y" ShowGridLines="False" Visibility="Hidden"/>
        </chartingToolkit:Chart.Axes>

    </chartingToolkit:Chart>
</Grid>

The area marked in red arrow must be removed
alt text

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:50:25+00:00Added an answer on May 19, 2026 at 2:50 am

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

                <ControlTemplate TargetType="charting:Chart">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
    
                            <datavis:Title Content="{TemplateBinding Title}" Style="{TemplateBinding TitleStyle}" />
    
                            <!-- Use a nested Grid to avoid possible clipping behavior resulting from ColumnSpan+Width=Auto -->
                            <Grid Grid.Row="1" Margin="0,15,0,15">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
    
                                <datavis:Legend x:Name="Legend" Title="{TemplateBinding LegendTitle}" Style="{TemplateBinding LegendStyle}" Grid.Column="1" />
                                <chartingprimitives:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}">
                                    <Grid Canvas.ZIndex="-1" Style="{TemplateBinding PlotAreaStyle}" />
                                    <Border Canvas.ZIndex="10" BorderBrush="#FF919191" BorderThickness="1" />
                                </chartingprimitives:EdgePanel>
                            </Grid>
                        </Grid>
                    </Border>
                </ControlTemplate>
    

    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"
    
    <Grid>
      <chartingToolkit:Chart x:Name="chart" Width="500" Height="300"
                             Margin="0, 0, 0, 0" Padding="0">
        <chartingToolkit:AreaSeries ItemsSource="{Binding}"  
                                      DependentValuePath="Value"
                                      IndependentValuePath="Key"
                                      Background="Red">
        </chartingToolkit:AreaSeries>
        <chartingToolkit:Chart.Axes>
          <chartingToolkit:LinearAxis Orientation="X" ShowGridLines="False" Height="0">
          </chartingToolkit:LinearAxis>
          <chartingToolkit:LinearAxis Orientation="Y" ShowGridLines="False" Width="0"/>
        </chartingToolkit:Chart.Axes>
        <chartingToolkit:Chart.Template>
          <ControlTemplate TargetType="chartingToolkit:Chart">
            <Border Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Padding="{TemplateBinding Padding}">
              <Grid>
                <chartingprimitives:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}">
                  <Grid Canvas.ZIndex="-1" Style="{TemplateBinding PlotAreaStyle}" />
                  <Border Canvas.ZIndex="10" BorderBrush="#FF919191" BorderThickness="1" />
                </chartingprimitives:EdgePanel>
              </Grid>
            </Border>
          </ControlTemplate>
        </chartingToolkit:Chart.Template>
      </chartingToolkit:Chart>
    </Grid>
    

    This will remove the padding that you are seeing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using WPF DataVisualization chart control to show some sample data. My problem
Using WPF/PRISM I want to log my messages through ILoggerFacade to my GUI (A
I've created a chart using the WPF toolkit (3.5) charting toolkit and I can't
Using the WPF Grid control is easy when your child elements are always contained
I'm trying to build a chart using the ColumnSeries from the wpf toolkit and
Using online interfaces to a version control system is a nice way to have
Using php/html, I want to retrieve email addresses (plus other information) from MySQL and
Using emacs on Ubuntu 11.10. I want to connect to a SQL Server database
I'm using datavisualization for silverlight 5. and the Stacked100BarSeries. I want the count of
As the title states, I want to group some ColumnSeries, I'm using Silverlight Charting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.