This is a migrated thread and some comments may be shown as answers.

Vertical Categorical Axis with Zoom - First label not rendered / visible / missing

2 Answers 78 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Dean Wyant
Top achievements
Rank 1
Dean Wyant asked on 08 Mar 2016, 04:30 PM

Version 2016_1_112

Using a BarSeries with VerticalAxis = CategoricalAxis and HorizontalAxis = LinearAxis. PlotMode = BetweenTicks or OnTicksPadded.

I am trying to have a minimum bar size so that the Category labels do no overlap (look nice) when the cart contains lots of data.
I achieve this by setting the PanMode to Vertical, the ZoomMode to None and adjusting the Zoom on LayoutUpdated.
Chart.Zoom = new Size(1, (MinGroupPixels(i.e. 16) / (PlotAreaClip.Height / Items.Count));

I only set the Zoom when it changes.

This gives me a chart with a vertical scroll bar (no user zooming). 
For some Zoom values / Heights, the first Y label is not rendered. IOW, if the scroll thumb is at the bottom, there is no label for the bottom bar (some may see this as the last label?). 
The bar is drawn fine and it appears that the space from the horizontal axis is the same whether the label is drawn or not.

I do not want PlotMode = OnTicks because the first and last bars are clipped. That does not look good.

I have tried rounding the zoom value to 2 decimal places - it did not help.

I have been aware of this issue for many years. I cannot find messages / etc. that address it. I thought that it would be fixed in this version (2016_1_112)

Please let me know the location of the code that causes the label to not be visible. 
Is there a workaround for this?

I have attached two pngs - one with the label and one showing the label missing. Both were scrolled completely to the bottom.

Thanks

2 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 11 Mar 2016, 09:52 AM
Hi Dean,

I was able to reproduce this behavior based on your description. The chart internally rounds many of the coordinates to int and I suspect that due to double rounding, a one pixel difference occurs. For example one code calculates a position of 245.499999 and other calculates 245.5, so the two are rounded to 245 and 246 respectively. But this is just a guess, we have yet to debug thoroughly and look for the origins of the issue.

Please let me know the location of the code that causes the label to not be visible. 
I am a bit unsure why you need this information, but there you go - VerticalAxisLayoutStrategy class, 63rd line. This is the UpdateTicksVisibility method in the else case, the tick.associatedLabel.layoutSlot.Bottom <= clipRect.Bottom fails because there is a one pixel difference. The class is internal and there is no way to make the categorical axis use a different strategy, so you cannot fix this with out-of-the-box means.

However, I am a little unsure if the chart is the best option for you. Do you use any other chart features? If not, I suggest you take a look at our databar control. With the chart, you are trying to set a static height for the bars in order to make it look like a table, a grid. With the databar you can use a grid and put the databars in the rows. You can check out our online documentation and sdk samples too.

I have logged this in our feedback portal and updated your Telerik points as a thank you for letting us know of this issue. Let us know if you need more information.

Regards,
Petar Marchev
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dean Wyant
Top achievements
Rank 1
answered on 11 Mar 2016, 05:22 PM

Thank you. 

The RadDataBar does not look like it will be useful to me as a replacement for the bar chart. I do understand having bars in a grid. It is the visual that counts.

I am not really trying to set a "static height" - I am setting a minimum so the bars and labels do not get crowded. The charts are re-sizable. So, the crowding can occur for any data count. If the chart is tall enough (or wide enough for vertical bars) versus the data count, the bars get bigger.

Thanks for the code location.

 

Tags
ChartView
Asked by
Dean Wyant
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Dean Wyant
Top achievements
Rank 1
Share this question
or