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 771967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:44:14+00:00 2026-05-14T18:44:14+00:00

I am using the WPF toolkit, and am trying to render a graph that

  • 0

I am using the WPF toolkit, and am trying to render a graph that looks like a histogram. In particular, I want each column to be right up against each other column. There should be no gaps between columns.

There are a number of components that you apply when creating a column graph. (See example XAML below). Does anybody know if there is a property you can set on one of the elements which refers to the width of the white space between columns?

                <charting:Chart Height="600" Width="Auto" HorizontalAlignment="Stretch" Name="MyChart"
                    Title="Column Graph" LegendTitle="Legend">

                    <charting:ColumnSeries 
                        Name="theColumnSeries"
                        Title="Series A"
                        IndependentValueBinding="{Binding Path=Name}"                
                        DependentValueBinding="{Binding Path=Population}"
                        Margin="0"
                        >
                    </charting:ColumnSeries>

                    <charting:Chart.Axes>
                        <charting:LinearAxis 
                            Orientation="Y" 
                            Minimum="200000" 
                            Maximum="2500000" 
                            ShowGridLines="True" />
                        <charting:CategoryAxis
                            Name="chartCategoryAxis"
                            />
                    </charting:Chart.Axes>
                </charting:Chart>
  • 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-14T18:44:14+00:00Added an answer on May 14, 2026 at 6:44 pm

    In the absence of magically-appearing answers, I downloaded the wpftoolkit code from codeplex.

    By reading the code, I can see in the method ColumnSeries.UpdateDataPoint, there is this line of code:

        double segmentWidth = coordinateRangeWidth * 0.8;
    

    So that’s a pretty definitive “no”, you cannot change the gap in between columns by setting a public property.

    The solution which I’m going to try is to write a new class that inherits from ColumnSeries, and overriding UpdateDataPoint.


    Later Edit

    OK, I got it to work. In case anyone’s interested, I’ve attached the full code for the HistogramSeries class.

    public class HistogramSeries : ColumnSeries, ISeries
    {
        protected override void UpdateDataPoint(DataPoint dataPoint)
        {
            // That set the height and width.
            base.UpdateDataPoint(dataPoint);
            // Now we override the part about setting the width
            object category = dataPoint.ActualIndependentValue;
            var coordinateRange = GetCategoryRange(category);
            double minimum = (double)coordinateRange.Minimum.Value;
            double maximum = (double)coordinateRange.Maximum.Value;
            double coordinateRangeWidth = (maximum - minimum);
            const int WIDTH_MULTIPLIER = 1; // Harcoded to 0.8 in the parent. Could make this a dependency property
            double segmentWidth = coordinateRangeWidth * WIDTH_MULTIPLIER;
            var columnSeries = SeriesHost.Series.OfType<ColumnSeries>().Where(series => series.ActualIndependentAxis == ActualIndependentAxis);
            int numberOfSeries = columnSeries.Count();
            double columnWidth = segmentWidth / numberOfSeries;
            int seriesIndex = columnSeries.IndexOf(this);
            double offset = seriesIndex * Math.Round(columnWidth) + coordinateRangeWidth * 0.1;
            double dataPointX = minimum + offset;
            double left = Math.Round(dataPointX);
            double width = Math.Round(columnWidth);
            Canvas.SetLeft(dataPoint, left);
            dataPoint.Width = width;
        }
        #region ISeries Members
        System.Collections.ObjectModel.ObservableCollection<object> ISeries.LegendItems
        {
            get { return base.LegendItems; }
        }
        #endregion
        #region IRequireSeriesHost Members
        ISeriesHost IRequireSeriesHost.SeriesHost
        {
            get { return base.SeriesHost;}
            set { base.SeriesHost = value; }
        }
        #endregion
    }
    // Copied from the DataVisualization library
    // (It was an internal class)
    static class MyEnumerableFunctions
    {
        public static int IndexOf(this IEnumerable that, object value)
        {
            int index = 0;
            foreach (object item in that)
            {
                if (object.ReferenceEquals(value, item) || value.Equals(item))
                {
                    return index;
                }
                index++;
            }
            return -1;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to sort a WPF-Toolkit DataGrid on a column which is bound like
I am using the WPF toolkit datagrid to display some data and want to
I am using the WPF Calendar that is part of the WPF Toolkit. I
I'm using the WPF toolkit datagrid, and I'd like to set the background color
Using the SplitButton from exceed's extended wpf toolkit , I would like to use
I am using wpf toolkit's datagrid i want to marge a row for all
I'm trying to build a chart using the ColumnSeries from the wpf toolkit and
I've been trying to use the WPF toolkit in a WPF application that I'm
I am using the WPF toolkit and the WPF toolkit extended and notice that
I've got two WPF Toolkit DataGrids , I'd like so that when the user

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.