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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

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.pngI.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 knowThanks!-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.