here are my comments on the bar chart problems:
> -- when I show a BarChart, and one of the values of the Y-axis is a bit
> long, e.g. republic of China, some portions of the word 'republic' would not
> fit into the window. Where can I set these margins? Is this the
> org.thechiselgroup.choosel.client.views.chart.BarChartViewContentDisplay >
> HORIZONTAL_BAR_LABEL_EXTRA_MARGIN = 20? I am not sure.
This is a bug - the margin should be calculated dynamically (see
http://code.google.com/p/choosel/issues/detail?id=64 ). The
HORIZONTAL_BAR_LABEL_EXTRA_MARGIN is used for statically setting the
margin right now - you can change it for demo purposes. I will
introduce a min margin and a max margin. For values that are longer
than max margin, I will cut them off and introduce '...' - the full
label will be accessible in a tooltip. Min and max margin will be
configurable via method calls. I will let you know once this is
implemented.
> -- Is the Borientation of BarChart is by default set to Horizontal?
> BarChartViewContentDisplay > LayoutType layout = LayoutType.HORIZONTAL; ?
> I could see in many places that the methods isVerticalBarChart(chartHeight,
> chartWidth) and isHorizontalBarChart are called and tested, but couldn't
> find where these chartHeight and chartWidth are actually being read from?
The default orientation is HORIZONTAL (set in the field declaration).
I just committed a change that should help you with adjusting the
layout as follows:
((BarChartViewContentDisplay)
view.getViewContentDisplay()).setLayout(LayoutType.VERTICAL); // or
AUTOMATIC
Cheers,
Lars
--
Lars Grammel
PhD Candidate, University of Victoria
http://larsgrammel.de
http://lgrammel.blogspot.com/
> -- It seems I cannot find the proper slot mappings for different
> visualizations. in Choosel.client.views.SlotResolver.java I can see what
> types of data are needed for which slots, but I can't find that which slots
> each visualization uses. I looked into
> org.thechiselgroup.choosel.client.views.chart for BarChart, PieChart and
> ScatterChart. But only figured out that BarChart has a value_slot. Couldn't
> find it for the rest.
The bar chart and pie chart use the following slots (pie chart uses
the ones from bar chart now):
BarChartViewContentDisplay.CHART_LABEL_SLOT
BarChartViewContentDisplay.CHART_VALUE_SLOT
The label slot is for the bar/wedge description, the value slot for the size.
The scatter plot uses
ScatterPlotViewContentDisplay.X_COORDINATE_SLOT
ScatterPlotViewContentDisplay.Y_COORDINATE_SLOT
for the x and y coordinates.
> -- Conceptually, are slots the labels for x and y axes for each
> visualization, if it is two-dimensional? And for Pie it would be the labels
> of the wedges?
Exactly.
> So, if I want to show the labels for the Chart, should I have two mappings?
> If you could, please, tell me what exactly slots are. What I am looking for
> is the label of the charts, e.g. time(X axis), number of users (y axis).
> This is what that will be shown the the Mapping toolbar on the right, right?
Yes. Slots are visual properties and dimensions offered by the
visualizations. They depend on the type of visualization (see above),
and are usually shown in the mapping toolbar on the right (although
this toolbar can be removed).
> From there, I can see that Label is the label for the y axis, and Value is
> the label for the x axis.
> What if I don't want to perform any math calculation on Value, i.e. no sum,
> average or so?
You could use the sum, because the sum over a single value returns the
value. However, 'sum' is then displayed on the axis label. I will
address this: http://code.google.com/p/choosel/issues/detail?id=132
> -- the mapping method: mapping(Slot slot, ResourceSetToValueResolver
> resolver). I am not sure if I understand the rationale of
> ResourceSetToValueResolver functions. In choose-test we had it for one of
> the mappings set to new FirstResourcePropertyResolver("property1") and to
> new CalculationResourceSetToValueResolver("property2",new SumCalculation())
> for the second mapping.
> I thinks this is also related to my first question, as I haven't fully
> understood the mapping method.
View items (e.g. a bar or a point in the scatter plot) can be based on
multiple resources (one bar could represent several people). In such a
case, there are calculations over the set of resources, e.g. a sum
over a property (which sums up this property for all resources in the
set). This is what 'new
CalculationResourceSetToValueResolver("property2",new
SumCalculation())' does (sum over values of property with name
'property2' for all the resources in the view item, e.g. a bar).
However, we often display single resources in view items, and just
need to access a specific value. This is what 'new
FirstResourcePropertyResolver("property1")' (return value of property
with name 'property1' from first resource in view item - assuming that
the view item contains a single resource).
I hope this helps,