+ Start a Discussion
MichaelpMichaelp 

Goolge Charts

Hi ,

 

I need to create a line chart showing 3 lines one for Actual 08 and 09

And the third for budget 09.

 

I have created 2 custom Objects so my Actual's are all part of one record for the year.

 I know the code for a pie chart is

 

IMAGE("http://chart.apis.google.com/chart?cht=c1&chd=t:" & Text( Variable_1__c )
& "," & Text(Variable_2 __c ) & "," & Text(Variable_3__c ) & "," & Text(Variable_4__c ) & "," & Text(Variable_5__c ) & "&chs=300x100&chf=bg,s,f3f3ec&chl= Variable 1 Name | Variable 2 Name | Variable 3 Name | Variable 4 Name | Variable 5 Name ", "Chart Title")

  

Do I need to create 36 fields to have my line charts????

 

Thank you

 

wesnoltewesnolte

Hey

 

Not sure if you've seen this but there are some salesforce components that can help you out with this. Check them out here: http://developer.force.com/codeshare/projectpage?id=a06300000030w9LAAQ.

 

Cheers,

Wes 

ExecbizExecbiz

Wes

 

That GoogleViz stuff looks great, I'm going to try it with my organization.  But I'm having a problem connecting to the repository.  In the instructions, it only gives instructions to load the repository with an older version of Eclipse (when you add a location, it only asks for the url, not the advanced options).  I tried in the new Eclipse, but I can't seem to have much luck.  From someone who's obviously used this tool before, can you give any insight on how to configure the Authentication and Connection to connect to the Google Visualization repository?

 

Thanks

Chris 

wesnoltewesnolte

Hey Chris

 

From what I can see that may be a firewall/proxy issue(http://www.velocityreviews.com/forums/t389191-new-to-subclipse-behind-restrictive-firewall-amp-ra-layer-request-failed.html), it doesn't seem I can do it from eclipse either.

 

I used the command line to check the code out before and that seems to still work. First make sure that SVN/CVS is configured to use a proxy. Since you're using it outside of eclipse it won't use the proxy configured there. Next click start > run > cmd, perhaps you'll want to navigate/create a folder. Then use the command 

 

svn checkout http://apex-google-visualization.googlecode.com/svn/trunk/ apex-google-visualization-read-only

 

Let me know how it goes,

Wes

ExecbizExecbiz

Where do I find proxy settings?  Sorry for the confusion, I've never used the repository explorer before.  I found CVS options, but nothing in there seemed to resemble proxy settings.  And when I tried to run from the command line into a local folder (My Documents/Repository) it says 'cvs' is not recognized as a command. 

wesnoltewesnolte

Ah I see. You have subversion installed in eclipse but no 'windows-wide' svn client. You could install tortoise SVN in windows, and I would suggest it. But if you send me a personal message with your email address I'll mail it to you.

 

Wes

MichaelpMichaelp

Thank you for your quick reply

 

I like google viz but being a non developer its hard to understand how to link the code to salesforce.

ExecbizExecbiz

Hey everyone,

 

If people have used this tool before, I could really use some help.  I've gotten my controller to return a JSON string, and passed it into the component (in my case a timeline) for a test dataset, just to see how it works.  Once I get the test dataset working, I should have no problem modifying it to fit my data.  But the chart doesn't show up.  A few things I know:

 

 - The JSON string is being passed into VF by the controller (I printed it onto the VF page as a test)

 - The panel for the chart exists, because when I print text below the code for the component, there is a block of space left

 

Here is a section of my controller, just passing in test data:

 

 

GoogleViz test = new GoogleViz();

 

test.cols = new list<GoogleViz.col> {

new GoogleViz.Col('col1','Date','d'),

new GoogleViz.Col('col2','Opportunity Amount','n')

};

 

for(Integer i = 1; i < 11; ++i){

GoogleViz.row s = new GoogleViz.row();

s.cells.add ( new GoogleViz.cell(Date.today() + i) );

s.cells.add ( new GoogleViz.cell( i ) );

 

test.addRow( s );

}

 

return test.toJsonString();

 

Pretty simple...

 

Here's the VF page:

 

 

<apex:page controller="GroupBreakdownController" showheader="false">

<html>

<body><!-- {!SalesActivity} -->

Number of Sprockets Sold By Rep<br/>

<c:TimeLine jsondata="{!SalesActivity}"

width="900px" height="300px"

zoomStartTime="new Date(2009, 07, 01)"

zoomEndTime="new Date(2009, 09, 30)"

displayZoomButtons="false"

colors="'#C2CD23'" />

 

{!SalesActivity}

 

</body>

</html>

</apex:page>

 

 Also simple, mostly just from the example.

 

And here's the output:

 

-------------------------------------------------------------------------------- 

 

Number of Sprockets Sold By Rep

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

{cols: [{id: "col1", label: "Date", type: "d"},{id: "col2", label:"Opportunity Amount", type: "n"}], rows: [[{v: new Date(2009, 8, 7, 0,0, 0), f: "8/7/2009"},{v: 1.0}],[{v: new Date(2009, 8, 8, 0, 0, 0), f:"8/8/2009"},{v: 2.0}],[{v: new Date(2009, 8, 9, 0, 0, 0), f:"8/9/2009"},{v: 3.0}],[{v: new Date(2009, 8, 10, 0, 0, 0), f:"8/10/2009"},{v: 4.0}],[{v: new Date(2009, 8, 11, 0, 0, 0), f:"8/11/2009"},{v: 5.0}],[{v: new Date(2009, 8, 12, 0, 0, 0), f:"8/12/2009"},{v: 6.0}],[{v: new Date(2009, 8, 13, 0, 0, 0), f:"8/13/2009"},{v: 7.0}],[{v: new Date(2009, 8, 14, 0, 0, 0), f:"8/14/2009"},{v: 8.0}],[{v: new Date(2009, 8, 15, 0, 0, 0), f:"8/15/2009"},{v: 9.0}],[{v: new Date(2009, 8, 16, 0, 0, 0), f:"8/16/2009"},{v: 10.0}]]} 

 

 --------------------------------------------------------------------------------------

 

 

Does anyone know what could be going on?  I've been struggling trying to get this component to work for hours, with no luck.  Could it have something to do with the formatting of the JSON output?  HELP!!

 

Thanks 

 

Message Edited by Execbiz on 08-06-2009 07:10 AM
Message Edited by Execbiz on 08-06-2009 07:11 AM
jlojlo

Execbiz -

 

Google has changed the structure of the GoogleViz data structures, so you'll need to tweak your code just a bit:

 

 

GoogleViz test = new GoogleViz();

test.cols = new list<GoogleViz.col> {
new GoogleViz.Col('col1','Date','date'),
new GoogleViz.Col('col2','Opportunity Amount','number')
};

for(Integer i = 1; i < 11; ++i){
GoogleViz.row s = new GoogleViz.row();
s.cells.add ( new GoogleViz.cell(Date.today() + i) );
s.cells.add ( new GoogleViz.cell( i ) );
test.addRow( s );
}

return test.toJsonString();

 

This change was made a while back, so, in addition to making the above change, you should probably download the latest code snapshot. The instructions for doing so can be found in steps 6 - 10 here: http://wiki.developerforce.com/index.php/Google_Visualizations_Prerequisite

 

(I recommend making a back up of your code, or being sure that you've checked in to your source code repository before following the above instructions. I also recommend performing these actions in a development environment first.)

 

I've made this change more explicit in the GViz wiki article, and I will publicize these changes on the blog soon.

 

 

ExecbizExecbiz
I am trying to load the source code into my repository on my Force.com IDE, but I have no option to load the SVN Repository Explorer perspective.  The only one even remotely like this is the CVS Repository.  Are these the same?  I think I have the latest version of the IDE installed.
ExecbizExecbiz

Also, I tried to reflect your suggestions in my code, but am still getting the same results, space is left for the graph but there is no graph showing.  Here is my updated code:

 

 

(All beginning VF code)<c:TimeLine jsondata="{!newSalesTimeline}" width="350px" height="300px" zoomStartTime="new Date(2009, 07, 01)" zoomEndTime="new Date(2009, 09, 30)" displayZoomButtons="false" colors="'#C2CD23'" />(etc)

 

 Here is the controller method:

 

 

public String getNewSalesTimeline(){ GoogleViz newSales = new GoogleViz(); newSales.cols = new List<GoogleViz.col>{ new GoogleViz.col('col1', 'Date', 'date'), new GoogleViz.col('col2', 'Sales', 'number') }; GoogleViz.row sales = new GoogleViz.row(); for(Integer i = 0; i < 10; ++i){ sales.cells.add( new GoogleViz.cell(Date.today() + i)); sales.cells.add( new GoogleViz.cell(i)); newSales.addRow(sales); } return sales.toJsonString();}

 As I've said, if I could get any timeline to work, I'd be able to model a real graph after this test, but the test has not worked thus far.

 

Thanks 

 

 

jlojlo

 


Execbiz wrote:
I am trying to load the source code into my repository on my Force.com IDE, but I have no option to load the SVN Repository Explorer perspective.  The only one even remotely like this is the CVS Repository.  Are these the same?  I think I have the latest version of the IDE installed.

 

 

Execbiz - if you've recently updated to the latest version of the Force.com IDE, you probably need to re-install Subclipse. I've updated the instructions: http://wiki.developerforce.com/index.php/Google_Visualizations_Install_Instructions

Message Edited by jlo on 08-26-2009 09:09 AM
jlojlo

Execbiz wrote:

Also, I tried to reflect your suggestions in my code, but am still getting the same results, space is left for the graph but there is no graph showing.  Here is my updated code:

 


 

 

Execbiz - Can you update to the latest version of the code? If you're still having problems, please post your full VF page code and the full controller code. (And it would be ideal if that code was well-formatted.)

Message Edited by jlo on 08-26-2009 09:11 AM