SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

0
0

Hello,

question about FastColumnRenderableSeries:
assuming the UseUniformWidth is set to True (all columns are same width) and Series already displayed: how I could get the actual width for one (any) column from code?

I.e. I do not want to use GetColumnWidth(IPointSeries points, IRenderPassData renderPassData) to computes the width of the columns to be drawn.

Just need to get the actual width for column already drawn.
From code.

Thanks!

-Egor

Version
4.2.5
  • You must to post comments
0
0

Hi Egor

There is no way to get the width of a column drawn, other than to hook into the code in FastColumnRenderableSeries and output an event when column is drawn and report the size.

for example:

    public class FastColumnRenderableSeriesEx : FastColumnRenderableSeries
    {
        public Action<double> OnGetColumnWidth { get; set; }

        protected override double GetColumnWidth(IPointSeries points, IRenderPassData renderPassData)
        {
            double width = base.GetColumnWidth(points, renderPassData);
            OnGetColumnWidth?.Invoke(width);
            return width;
        }
    }

this function (GetColumnWidth) is called once when the column series draws.

Does that help?

Best regards,
Andrew

  • Egor Baykov
    Andrew, thanks a lot – it works! Just to make sure I’m implementing the things in most intelligent way: My task is to adjust the Annotation font with Column width (which is changed based on bar numbers) Please see: https://i.stack.imgur.com/bXUb1.png I.e. reduce FontSize if possible. If it is too small – suppress the annotation. I.e to my vision the logic shall be based on Column width and the hook way you suggested is working for this. Unless there is better way to achieve the same…please let me know Thanks! -Egor
  • Andrew
    I think that sounds sane. There was a solution before on adjusting annotation scaling based on chart size: https://www.scichart.com/questions/question/text-annotation-resizing-with-controltemplates
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

SciChart WPF v6 BETA released! Note pricing/licensing changes are coming. Contact us to beat the rise!Read more
+