Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>For Kevin</strong></p> <p>Since Kevin originally asked the question, let me just state first: That's wierd. The presentation of the set of column series is offset from the left hand origin that it should have. As intimated in my comment many moons ago I'd need more details to try to discern why that wierdness is happening.</p> <p><strong>For LordCover</strong></p> <p>To answer the addition from LordCover which I don't think is really related.</p> <p>The answer really depends on what your intention is for setting the width. I'll answer on basis that you just want thinner columns (bigger gaps between columns). I've choosen this basis because I can't think of any other reason for doing it.</p> <p>The code in the <code>ColumnSeries</code> specifically assigns the <code>Width</code> of each data point thereby trumping any value you might have set in a style. So just setting the width in a data point style isn't going to work. In addition if you have multiple series then you'll lose the default palette and you'll have to do all that work yourself too.</p> <p>What you can do is create a derivative ColumnSeries. Something like:-</p> <pre><code>public class FixedWidthColumnSeries : ColumnSeries { #region public double ColumnWidth public double ColumnWidth { get { return (double)GetValue(ColumnWidthProperty); } set { SetValue(ColumnWidthProperty, value); } } public static readonly DependencyProperty ColumnWidthProperty = DependencyProperty.Register( "ColumnWidth", typeof(double), typeof(FixedWidthColumnSeries), new PropertyMetadata(5.0)); #endregion public double ColumnWidth protected override void UpdateDataPoint(DataPoint dataPoint) { base.UpdateDataPoint(dataPoint); double originalWidth = dataPoint.Width; double newWidth = ColumnWidth; dataPoint.Width = newWidth; Canvas.SetLeft(dataPoint, Canvas.GetLeft(dataPoint) + (originalWidth - newWidth) / 2); } } </code></pre> <p>This class lets the original <code>ColumnSeries</code> do all the heavy lifting then tweaks Width and Left positions of the data point afterward.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload