I have a horizontal bar chart that is dynamic: it starts out empty and I add bars over time. The labels for the bars are unknown until the data arrives. That means as each bar and its label are added, the size of the chart changes each time a label is added that is longer than a previous label. What I'd like to do is set all the labels to a default value consisting of, say 15 non-breaking spaces, then replace them with regular text as data arrives.
So, my question is, is there a way to set the value of YAxis labels to a set number of white space characters? I've been trying things like %20 and , and haven't been able to make it work.
Thanks for replying, but it's not quite that simple. Here's the problem: I start out with a horizontal bar chart containing no bars and no labels. At startup, the chart takes up the entire space, i.e., the label area is compressed to nothing. When I add the first data point, a label is added, so the width of the chart decreases to accommodate it. Then, every time I add a new bar, the width of the chart will decrease if the new label length is greater than the previous label length. I'd like the chart to start out with a reasonable width reserved for labels, and not be changing width as I add data.
And, as near as I can tell, the labels show the typical html behavior of ignoring extra white space above a single space. So, I couldn't decide all the labels should be 15 characters long and pad each one with the calculated extra spaces. Also, I tried adding codes instead of spaces, and they showed up as in the labels.
When you're right, you're right. I was starting off initializing all the labels with strings composed entirely of spaces, and in that case, the spaces were ignored and the chart took up the entire space until I updated one of the labels with some non-space characters. Once I get the first real label in, the extra space padding works, as you pointed out.
So, my solution to the initialization problem is to set the first label to something like this : "------------------" and set the label color to white. Then when the first real data arrives, I update the label text and set the color to black.