Hello MC,
I just noticed you are from google:). Are you part of the
Visualization/GWT group?
I think this might be a bug. After a lot of poking and playing, I
finally looked at the generated JS and it doesn't appear to have any
issues. However, my labels are still slanted at 90 degrees. Below is
what I found in the generated JS:
current_chart = new
com_google_gwt_visualization_client_visualizations_LineChart_LineChart__Lcom_google_gwt_visualization_client_AbstractDataTable_2Lcom_google_gwt_visualization_client_visualizations_LineChart
$Options_2V(data_points, {height:100, width:500, hAxis:
{slantedText:true, slantedTextAngle:90}});
I combined JSNI and java to get the above:
/*******************************************/
LineChart current_chart = new LineChart(data_points, getHaxis());
public static native Options getHaxis() /*-{
//alert('requesting options..');
var options = {height:100,width:500,hAxis:
{slantedText:true,slantedTextAngle:90}};
//alert('options look like' + options);
return options;
}-*/;
/****************************************/
Can you see any issues? Or do you agree this is a defect? Is there
perhaps a working example that shows GWT with LineCharts that have
slanted text labels that are 90 degrees?
Thanks much!
On Jan 6, 1:17 pm, Benny <[email protected]> wrote:
> Hi MC,
>
> That did not work unfortunately either :(. I googled some more and
> found a suggestion to actually do these options via JSNI. So I tried
> doing the following, and still doesn't work. I am really frustrated!!!
>
> public static native void getHaxis(Options options) /*-{
> var hAxis = new Array();
> hAxis['slantedText']=true;
> hAxis['slantedTextAngle']=90;
> options['hAxis']=hAxis;
> }-*/;
>
> And then I called the above method with my options...
>
> Does any one have any input? Don't we have some google developers
> around the community either?
>
> Thanks,
>
> On Jan 5, 6:51 am, MC Get Vizzy <[email protected]> wrote:
>
>
>
>
>
>
>
> > Try
>
> > Options hAxis = Options.create();
> > hAxis.set("slantedText", true);
> > hAxis.set("slantedTextAngle", 90.0);
> > options.set("hAxis", hAxis);
>
> > Let me know if that helps.
>
> > Vizzy
>
> > On Wed, Jan 5, 2011 at 6:48 AM, Benny <[email protected]> wrote:
> > > Thanks MC!
>
> > > Unfortunately, that did not work. I changed the options as follows,
> > > and my labels are still slanted.
>
> > > Options options = Options.create();
> > > options.setHeight(250);
> > > options.setLineSize(1);
> > > options.setPointSize(0);
> > > Options hAxis = Options.create();
> > > hAxis.set("slantedTextAngle", 90.0);
> > > options.set("hAxis", hAxis);
> > > options.set("legend", "bottom");
>
> > > Any other suggestions?
>
> > > On Jan 4, 8:07 am, MC Get Vizzy <[email protected]> wrote:
> > > > On Mon, Jan 3, 2011 at 6:18 PM, Benny <[email protected]> wrote:
> > > > > Hello,
>
> > > > > This is my first project to use the google visualization API - so, I
> > > > > could simply be overlooking the obvious. I have been trying to solve
> > > > > this since yesterday, and I am at the verge of madness:(.
>
> > > > > I am using LineChart with GWT and I am drawing a chart for appx 8500
> > > > > points (some monthly data). These are points stored in a local
> > > > > database to the web server. My latency is pretty low (app 3 secs).
> > > > > However, when the cart is drawn, the horizontal labels are
> > > > > understandably cluttered and the text is slanted. I am trying to
> > > > > change this to be:
>
> > > > > 1. Labels are displayed in intervals (ones for each day's data)
> > > > > 2. The label angle is 90
>
> > > > > I have tried the below and none of them work:
>
> > > > > 1. Tried to populate the DataTable X values only when I would like
> > > > > them to be displayed. When I do this, the instead of seeing all the
> > > > > values I added, I see a fraction of them (eg. I added 30 values and
> > > > > only 4 labels got displayed). Is there an easier more standard way to
> > > > > do this? Below is the code I tried:
>
> > > > > int current_date = -1;
> > > > > for (DataCapsule result : data)
> > > > > {
> > > > > data_points.addRow();
> > > > > if (current_date == -1 || current_date !=
> > > > > result.getDate().getDate())
> > > > > {
> > > > > String date_field =
> > > > > DateTimeFormat.getMediumDateFormat().format(
> > > > > result.getDate());
> > > > > data_points.setValue(i, 0, date_field);
> > > > > current_date =
> > > result.getDate().getDate();
> > > > > }
> > > > > else
> > > > > {
> > > > > data_points.setValue(i, 0, "");
> > > > > }
> > > > > data_points.setValue(i, 1, result.getValue());
> > > > > ++i;
> > > > > }
>
> > > > Try using the "hAxis.showTextEvery" option.
>
> > > > > 2. I tried to use the options.set("hAxis.slantedTextAngle",90.0). But
> > > > > this seemed to have no effect!
>
> > > > Unfortunately, setting these "sub-options" from GWT is not
> > > straightforward.
> > > > Currently, you need some kind of hack like:
>
> > > > Options hAxis = Options.create();
> > > > hAxis.set("slantedTextAngle", 90.0);
> > > > options.set("hAxis", hAxis);
>
> > > > HTH
>
> > > > MC Get Vizzy
>
> > > > > I appreciate your input.
>
> > > > > Thanks,
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > Groups
> > > > > "Google Visualization API" group.
> > > > > To post to this group, send email to
> > > > > [email protected].
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]<google-visualization-
> > > > > api%[email protected]><google-visualization-
> > > api%[email protected] <api%[email protected]>>
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/google-visualization-api?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Google Visualization API" group.
> > > To post to this group, send email to
> > > [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<google-visualization-
> > > api%[email protected]>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-visualization-api?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.