Flex mx:axisrenderer How do I prevent the labels from being scaled - apache-flex

I have a line chart that sometimes contains a number of data points. I have solved how to prevent the horizontal axis from displaying too many labels using custom label functions and data functions. My problem is forcing the AxisRenderer not to scale down my labels.
I'm using the labelRotation property so the canDropLabels and canStagger properties are not an option.
Thanks in advance for any replies.

Try use gutter, gutter set are for the axis labels (if you want u can try to read the code of the AxisRenderer, and see how it use the gutter and other parameters to scale if need the text.
You can set the gutter by style like this (this work for me):
LineChart {
gutterLeft:50;
gutterRight:50;
gutterBottom:50;
}

I believe this can be done by editing the labelRenderer property. Take a look at the second example on this page (Formatting charts), they define a custom component to use as the label. You can do something like that to maintain whatever look you want.

I ran into the same issue. In my case (for the data that I'm plotting), simply setting canDropLabels to true (either in ActionScript or MXML as below) resulted in widening the margins allocated (I'm guessing) to the label text in the chart such that I never saw the text render smaller than set by fontSize below. Try it, it may be all you need.
hAxisRenderer.setStyle("canDropLabels",true);
...
<mx:AxisRenderer id="hAxisRenderer" placement="bottom"
tickPlacement="inside" tickLength="8"
canStagger="false" canDropLabels="false" fontSize="12">
For reference: http://blog.flexexamples.com/2007/10/16/dropping-labels-in-a-flex-chart/

Related

r googleVis: How to control html tooltips (positioning, border and background)

I have figured out how to create custom html tooltips by using roles via googleVis. I can easily modify the content using html but I cannot understand how I can control the tooltip box itself.
My problem was generated because some of the custom tooltips I created are falling outside my chart area and I tried (unsuccessfully) to find a way to control the tooltip position. Idealy I would like to make them behave in the exact same way default tooltips behave in googleVis (always stay withinin the chart area).
When I later implemented the same concept into a line chart I found that I have another problem as well. The tooltip is falling on the line so I cannot see what is the exact point that refers to the tooltip.
Would it be possible for example to keep the callout style of default googleVis tooltip and change the content with HTML?
Additionally, do you know if there is any way to control more tooltip properties like border and background color?
i was also looking for the same
1) when laying out your data, make sure it has columns alternating between, say, data and tooltips, data and tooltips,... that way it is possible to customize tooltips for multiple columns (it does not work if you just append - à la cbind - a set of tooltips columns to your data frame).
Additionally try this http://rcharts.io/viewer/?6644957#.VHcpEkvrdbg

difference between <s:Line> and graphics.lineTo()

If I skin a button and use the AS3 graphice.clear() and graphics.lineTo and beginFill to create a shape, the button overlaps other items in the container.
When I use the and mxml to create the same shape, the button is neatly positioned inside the container.
Why is that?
This is probably happening because Flex is unable to calculate the size of your dynamically drawn button, while the MXML version allows the size to be calculated prior to being displayed. You may need to override the measure method to calculate the width/height. If that's not the issue, then post some code so we can take a closer look. Hope that helps.
Because the Line Object is doing a bunch of checks and extra work you aren't doing when you use the Graphics object. Look at the code for spark.primitives.Line to see what its doing that you aren't.

trouble with custom 'Text Bubble' component (examples included)

I'm trying to use a custom Text component to show a series of comments. I got
the original idea from:
http://www.eonflex.com/?p=40
I've got the base case working but I am stuck with 2 problems I cant seem to
figure out:
Since I am drawing around the text, the actual height of each bubble is
greater than that of the Text field, as a result, the last bubble is always
chopped off. I have tried explicitly overriding the height getter, and adding
some padding, but I cant seem to get it right. You can see an example here:
http://test.lambandtunafish.com/bubbles/CommentTest.swf
In my layout, I have 2 VBoxes (one nested inside the other). The first vbox
shows a form where the user can enter a comment, and the second box has all the
comments. In order to ensure that the scrollbars only show up on the second box,
I set minHeight="0" on the nested VBox, but then for some reason, some comments'
text is shifted to the right. You can see an example here (look at the first
comment): http://test.lambandtunafish.com/bubbles/CommentTest-minHeight.swf
Rather than posting the code here, I've provided some links:
Container: http://test.lambandtunafish.com/bubbles/CommentTest.mxml
Bubble: http://test.lambandtunafish.com/bubbles/CommentBubble.as
If anyone has any ideas, I would appreciate it.
Thanks!
Have you considered adding padding to you VBoxes?
<mx:VBox id="vBox" verticalGap = "100"/>
There is a nice example here

Flex BarChart long text

In my application, I am using a BarChart to display data. However, the text in the category axis can be too long to display on the chart, so flex adjusts the font size automatically to the point that the data is either unreadable, or the text is partially visible.
The length of the text varies every time new data comes in, so I can't set the gutterLeft attribute to a static value at runtime.
Two things that come to my mind are:
Change the gutter dynamically according to new data
Have a scroll bar on the categoryaxis so that if any text won't fit in the space, the user can scroll to see it
Any help would be appreciated.
EDIT:
I have hundreds of rows of data being graphed at once, so I can't really use a legend for each item.
Also, I have no idea how to change the gutterLeft property with actionscript. Doing it in MXML is as simple as
gutterLeft="100"
but I cannot access the property using actionscript. I also tried to bind the gutterLeft variable to an integer and change that integer and it still didn't work. :|
the problem is that gutterleft is a style, and therefor needs to be set as one when using actionscript.
I was hoping to see your code to give a more detailed answer but what you want to do is:
mychart.setStyle("gutterLeft",500);

Flex3 Linechart points are too close to the edge

I have a Flex3 LineChart component using an CircleItemRenderer and the datapoints are being cut off because they are too close to the edge. Here's what it looks like:
http://img29.imageshack.us/img29/3850/chartx.png
As you can see, the circles on the left and right sides are being cut off.
How can I make the LineSeries area, plus the horizontal labels, narrower so it fits in the chart area?
Thanks!
I had the same issue and was able to resolve it by setting the clipContent attribute in the chart tag to false. I found this solution on Amy's Flex Diary.
You might want to set the maximum and minimum values in your LinearAxis in the horizontalAxis object. Check the API for more information: http://livedocs.adobe.com/flex/3/langref/mx/charts/LinearAxis.html
The Line Chart determines automatically these values to fill all the elements in the screen. You might want to change these values so the graph has some space at the sides.
You can set the padding property on the horizontalAxis and verticalAxis child objects as well...
Adjust the mask on the chart component.
I got this to work by changing the type from LineChart to ColumnChart. I still had all of the same axis definitions including Line Series. The results are the same Line graph, but more centered on the graph instead of touching the edges. None of the other padding or gutters were what I was looking for.
I got d solution.
create creationComplete event in LineChart
edit horizontalAxis's padding you want
e.target.horizontalAxis.padding = 0.2;

Resources