You need to sign in to do that
Don't have an account?
Google visualizations bar chart
I am trying to use google visualizations for the first time. I installed parts of the code share project referenced here. I am producing a bar chart, but I have to specify the vertical height in pixels. I'd like to calculate the vertical height based on the number of bars; otherwise google makes the text larger or smaller to fit, and it's always the wrong size.
But if I try to use an apex variable, when I try to save the VF page salesforce complains that "Error: Literal value is required for attribute height in <c:BarChart>".
Looking at the Google api docs, I don't see a way to tell Google to determine an appropriate size for the height.
Is it possible to specify a calculated height for the barchart, based on the number of rows? The code seems to insist on a predetermined integer pixel count.
<apex:component > <apex:attribute name="jsondata" description="This is the chart data" type="string" required="true" /> <apex:attribute name="title" description="This is the chart title" type="string" required="true" /> <apex:attribute name="height" description="This is the chart height" type="integer" default="250" />
<apex:component > <apex:attribute name="jsondata" description="This is the chart data" type="string" required="true" /> <apex:attribute name="title" description="This is the chart title" type="string" required="true" /> <apex:attribute name="height" description="This is the chart height" type="integer" />
All Answers
I had tried making the following change in the component. The result was a bar chart of zero height.
<apex:component > <apex:attribute name="jsondata" description="This is the chart data" type="string" required="true" /> <apex:attribute name="title" description="This is the chart title" type="string" required="true" /> <apex:attribute name="height" description="This is the chart height" type="integer" default="250" />
<apex:component > <apex:attribute name="jsondata" description="This is the chart data" type="string" required="true" /> <apex:attribute name="title" description="This is the chart title" type="string" required="true" /> <apex:attribute name="height" description="This is the chart height" type="integer" />