Flex - Placement of Legend for a chart - apache-flex

I would like to be able to specify the placement of a legend for a linechart. Currently, it continues to appear to the right of the chart. I have tried playing with the width/height of the chart to no avail... Putting the legend before the linechart in the mxml causes it to appear to the left. I can't seem to get it appear at the bottom though. I can't seem to find any good examples for this. They don't seem to specify anything but the legend usually shows up below the chart, I can't seem to do it. Optionally, it would be okay to somehow minimize the legend..

what container are your line chart and legend in? its sounds like you are using either an HBox or an application with the layout="horizontal". To move the legend below use either a VBox or application layout of vertical. Or you can use a canvas and use constraints (left, right, top, bottom) or x and y coordinates

Related

Unwanted overlapping text in watch glance

In my watch glance I have selected the following layout in IB:
For some unknown reason the two top labels want to overlap...sometimes. Like this:
My understanding is that it shouldn't be possible to overlap labels using watchkit. Any idea of how to solve this problem?
I have often found that when labels are not in a Group container, the layout can be unpredictable. I would recommend placing the two top labels in a Group and then make the first Vertical Position Top and the second Vertical Position Bottom. Also be sure to set both labels to use "size to fit content."

Javafx chart show more empty space

I am customizing the javafx charts a bit adding valuelabels etc above bars and sliding out certain parts of piecharts. The problem is some of the extras come outside of the visual area.
Is there a simple way to get piecharts to become smaller (but the chart component itself retain its size so that there is more empty space surround the pie?
The same issue with barcharts. I need more empty space above my vertical bars, and more empty space to the right of my horizontal bars.
All data in the table has Number(mostly BigDeicmal) for its value and String for its key and series.

Positioning ZedGraph legend at middle right not top right?

Is there some way to position the legend using ZedGraph so that it is on the right-hand side, but vertically centred. Using:
output.Legend.Position = ZedGraph.LegendPos.Right
positions the legend at the top right, but beside a pie chart this looks misaligned. Is there a way to get the legend to vertically centre?
Changing output.Legend.Location.Y seems to have no effect, nor does trying output.Legend.Location.AlignV = ZedGraph.AlignV.Center
Added in response to first answer below...
Floating, reducing the chart size and positioning the label does centre vertically, and is better than I had managed previously. Unfortunately it has a side-effect, in that the legend switches to multi-column and tries to occupy half the width of the total chart area, thus usually overlapping the chart (see picture). Looking at the ZedGraph source, this wider mode is used for all layouts except Left and Right.
Location is only enabled when Legend.Position is set to Float.
You could do like this (C#):
output.Legend.Position = LegendPos.Float;
output.Legend.Location =
new Location(1.05f, 0.5f, CoordType.ChartFraction, AlignH.Right, AlignV.Center);
with the probably undesired "feature" that the legend is drawn partially inside the chart:
To workaround this issue I believe you also have to manually resize your chart:
output.Chart.Rect = new RectangleF(xstart, ystart, xsize, ysize);
Anders' answer nearly worked, except it had the side-effect of changing the width of the legend. This led me to download the source code to find out why, and I discovered that the legend positioning code is actually quite trivial. LegendPos.Right is only referenced twice in the code, both times in Legend.CalcRect
Adding a new LegendPos.MiddleRight only needs it added to the enum, a case for MiddleRight added to the first Switch which runs the same code as Right. And in the second Switch in CalcRect the following:
case LegendPos.MiddleRight:
newRect.X = clientRect.Right - totLegWidth;
newRect.Y = tChartRect.Top + tChartRect.Height / 2 - totLegHeight / 2;
tChartRect.Width -= totLegWidth + gapPix;
break;
This is the same code as for LegendPos.Right except for the newRect.Y line.

NSTableView get rid blank space separating columns

I have an NSTableView with 4 columns. I also have a custom background color for each row. The only problem is I have these ugly white spaces where the gridlines would go in both the horizontal and vertical axis. I have both unchecked in IB, but they still show up. How can I get rid of the vertical ones and change the color and size of the horizontal ones?
Here's what I see:
alt text http://img815.imageshack.us/img815/9030/homex.png
To get rid of vertical spaces but keep the horizontal ones:
[yourTableView setIntercellSpacing:NSMakeSize(0.0, 2.0)];
See Apple documentation for more details.
You'll need to override drawClipInRect to draw your own grid. The article I linked to modifies it so it only draws vertical gridlines. You'll have to modify it to only draw horizontal ones instead, but the basic strategy is the same: By overriding it, you can make it not draw vertical lines by simply not including the code for it.

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