Profile Picture

Resizing bar width with parent and data set size to avoid overlapping

Posted By Wincy Mok 13 Years Ago

Resizing bar width with parent and data set size to avoid overlapping

Author
Message
Wincy Mok
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 1, Visits: 1

Hello,

I'm new to Nevron and am having problems with the resizing of the width of the bars in a horizontal bar chart and wonder if anyone knows of a solution.

I'm trying to automatically generate a bar chart for a set of data that changes size all the time, so one day the data might only contain 10 bars, the next day it may contain 100s. I would like each bar to be distinct from one another, with no spaces between each bar, but no overlap either.

However when I extend the data set, the bars start overlapping, similarly, when I increase the chart size, the bars start spacing further and further apart.

I tried resizing the bars using parent percentage, but the addition of data points messes up the formatting as the percentage is static even though the number of bars have increased:

bar.BarWidth = new NLength(1.35f, NRelativeUnit.ParentPercentage);

 

I then tried taking the chart dimensions, and dividing it by the value range in the following formula:

range = chart.Height/((maxVal - minVal)/tickInterval

bar.BarWidth = new NLength((float)(range), NGraphicsUnit.Point);

but the chart height seems to remain static even if you resize the root panel (chart.width stays 55 even if I change panel size from 800x800 to 1500x1500).

Is there an easier way to resize the bar width in proportion to the data set size and the chart size that will avoid this spacing/overlap problem? Any insights would be appreciated.

Wincy

 






Similar Topics


Reading This Topic