Multiple Tables & Charts From a Single MySQL Query? Possible?

100 views
Skip to first unread message

Brandon Matthews

unread,
Feb 7, 2015, 7:35:42 PM2/7/15
to google-visua...@googlegroups.com
I'm probably missing the obvious and I'm thinking the answer lies in "dataview's" yet I see where it applies to rendering a chart and table for example, of the same queried data, but what I'd like to do is something like in which many chart options can be derived from a single query?

Currently, and I'll keep it simple for now, to render 4 linecharts to display 30day, 60day, 90day and 180day data, I have to run 4 queries:

php query 1 =- 180 days
convert to JSON,
render 180 day chart

php query 2 =- 90 days
convert to JSON,
render 90 day chart

then 60, then 30  ....

Yet I'm blatantly aware that all the necessary data to render all 4 is included in the first 180 day query. Page load times are just killing me and while I can show fewer images per page, the coding cannot be assigned per page on wordpress despite several plugins that are supposed to do just that. I dont know what they add to the code but it negates any charts from  being rendered, forcing me to place all needed code into the header.php file. The results are great, but even the homepage takes far too long to load.. I should mention,  The above example is only "SOME" of the data needed to render a page like this, but again, even if I break it down into 10 individual pages, I'm forced into running the same scripts and php calls to my database on every page, needed or not. 


..and in case you ask I'll offer it up now also. I noticed some posts where it was stated only one callback should be made. The datatables seem to do well with the concept,

<script type="text/javascript">
 google.load('visualization', '1', {packages: ['table']});                
 google.setOnLoadCallback(drawTable);
  function drawTable() {
var data4 = new google.visualization.DataTable(<?=$swtable1?>);
var data5 = new google.visualization.DataTable(<?=$swtable2?>);
var data6 = new google.visualization.DataTable(<?=$swtable5?>);
var data7 = new google.visualization.DataTable(<?=$swtable6?>);
var data8 = new google.visualization.DataTable(<?=$swtable7?>);
var data9 = new google.visualization.DataTable(<?=$swtable8?>);
      var data10 = new google.visualization.DataTable(<?=$swtable9?>);
var data11 = new google.visualization.DataTable(<?=$swtable10?>);
var data12 = new google.visualization.DataTable(<?=$swtable11?>);

var table4 = new google.visualization.Table(document.getElementById('swtable1_div'));
    table4.draw(data4, {showRowNumber: true});
var table5 = new google.visualization.Table(document.getElementById('swtable2_div'));
    table5.draw(data5, {showRowNumber: true});
var table6 = new google.visualization.Table(document.getElementById('swtable5_div'));
    table6.draw(data6, {showRowNumber: true});
  var table7 = new google.visualization.Table(document.getElementById('swtable6_div'));
    table7.draw(data7, {showRowNumber: true});
    var table8 = new google.visualization.Table(document.getElementById('swtable7_div'));
    table8.draw(data8, {showRowNumber: true});
        var table9 = new google.visualization.Table(document.getElementById('swtable8_div'));
    table9.draw(data9, {showRowNumber: true});
        var table10 = new google.visualization.Table(document.getElementById('swtable9_div'));
    table10.draw(data10, {showRowNumber: true});
var table11 = new google.visualization.Table(document.getElementById('swtable10_div'));
    table11.draw(data11, {showRowNumber: true});
var table12 = new google.visualization.Table(document.getElementById('swtable11_div'));
    table12.draw(data12, {showRowNumber: true});
}
</script> 

 But the charts do not:
 (the following does not work)

<script type="text/javascript">
 google.load("visualization", "1", {packages:["corechart"]});
 google.setOnLoadCallback(drawChart);
 function drawChart() {
var data7 = new google.visualization.DataTable(<?=$Data212?>);
var data8 = new google.visualization.DataTable(<?=$jsonData21b?>);
var data9 = new google.visualization.DataTable(<?=$jsonTablepie?>);
var data10 = new google.visualization.DataTable(<?=$jsonTablepie?>);
var data11 = new google.visualization.DataTable(<?=$jsonData30?>);
var data12 = new google.visualization.DataTable(<?=$jsonData60?>);
var data13 = new google.visualization.DataTable(<?=$jsonData90?>);
var data14 = new google.visualization.DataTable(<?=$jsonData180?>);
var data15 = new google.visualization.DataTable(<?=$jsonData30dp?>);
var data16 = new google.visualization.DataTable(<?=$jsonData60dp?>);
var data17 = new google.visualization.DataTable(<?=$jsonData90dp?>);
var data18 = new google.visualization.DataTable(<?=$jsonData180dp?>);
var options7 = {title: '<?=$query?>: Total Short Volume to Price Comparison',
tooltip: {textStyle: fontSize:14}}, 
titleTextStyle:{fontSize:12}, 
width: 525, 
height:300,
hAxis: {textStyle: {fontSize:11,fontStyle:'bold'}}, 
legend: maxLines:10, 
textStyle: {fontSize: 11.5}}, 
seriesType: "lines", 
series: { 0: {type: line", targetAxisIndex:0,color:'#2148F7'}, 
1: {type: line", targetAxisIndex:1, color:'#BF0F0F'}
}, 
vAxes:{ 0:{title:'Price',titleTextStyle: {fontSize:14},textStyle:{color: blue',fontSize:15}}, 
1:{title:'Total Short Pct',titleTextStyle: {fontSize:14},textStyle:{color: 'red',fontSize:15}}
}}; 
var options8 = {title: '<?=$query?>: Open Short Volume to Price Comparison',
tooltip: {textStyle: fontSize:14}}, 
titleTextStyle:{fontSize:12},
width: 525, 
height:300, 
hAxis: { textStyle: {fontSize:11,fontStyle:'bold'}},
legend: maxLines:10, textStyle: {fontSize: 11.5}}, 
seriesType: "lines", 
series: { 0: {type: line", targetAxisIndex:0,color:'#2148F7'}, 
1: {type: line", targetAxisIndex:1, color:'#BF0F0F'}}, 
vAxes:{ 0:{title:'Price',titleTextStyle: {fontSize:14},textStyle:{color: blue',fontSize:15}}, 
1:{title:'Open Short Pct',titleTextStyle: {fontSize:14},textStyle:{color: 'red',fontSize:15}}
}};      
var options9 = {title: '<?=$query?>: Volume Comparison', width: 525, height: 300, is3D: 'true'};
var options10 = {title: '<?=$query?>: Volume Comparison', width: 525, height: 300, is3D: 'false'};
var options11 = {title: '<?=$query?>: 30 day Short Volume Percentage', width: 530, height: 300};
var options12 = {title: '<?=$query?>: 60 day Short Volume Percentage', width:530, height:300};
var options13 = {title: '<?=$query?>: 90 day Short Volume Percentage', width: 400, height: 300};
var options14 = {title: '<?=$query?>: 180 day Short Volume Percentage', width: 400, height: 300};
  var options15 = {title: '<?=$query?>: 30 day Dark Pool Volume Percentages', width: 530, height: 300};
var options16 = { title: '<?=$query?>: 60 day Dark Pool Volume Percentages', width: 400, height: 300};
var options17 = { title: '<?=$query?>: 90 day Dark Pool Volume Percentages', width: 400, height: 300};
var options18 = { title: '<?=$query?>: 180 day Dark Pool Volume Percentages', width: 400, height: 300};

var chart7 = new google.visualization.ComboChart(document.getElementById('chart212_div'));
      chart7.draw(data7, options7);
var chart8 = new google.visualization.ComboChart(document.getElementById('linechart21_div'));
chart8.draw(data8, options8); 
var chart9= new google.visualization.PieChart(document.getElementById('piechart_div'));
      chart9.draw(data9, options9);
var chart10 = new google.visualization.BarChart(document.getElementById('BARchart_div'));
chart10.draw(data10, options10);
var chart11 = new google.visualization.LineChart(document.getElementById('linechart30_div'));
      chart11.draw(data11, options11);
var chart12 = new google.visualization.LineChart(document.getElementById('linechart60_div'));
      chart12.draw(data12, options12);
var chart13 = new google.visualization.LineChart(document.getElementById('linechart90_div'));
      chart13.draw(data13, options13);
var chart14 = new google.visualization.LineChart(document.getElementById('linechart180_div'));
      chart14.draw(data14, options14);
var chart15 = new google.visualization.LineChart(document.getElementById('darkpool30_div'));
chart15.draw(data15, options15);
var chart16 = new google.visualization.LineChart(document.getElementById('darkpool60_div'));
chart16.draw16(data16, options16);
var chart 17= new google.visualization.LineChart(document.getElementById('darkpoo90_div'));
chart17.draw(data17, options17);
var chart18 = new google.visualization.LineChart(document.getElementById('darkpool180_div'));
chart18.draw(data18, options18);
}
</script>

Forcing me time and time again to start over with:each separately, which is where I am at now in case it's just a "where's Waldo" issue and I'm not seeing the obvious blunder...

The horrific page load times can be seen at realshortdata.com and if you search a ticker symbol in the righthand sidebar, as I did with 'GOOG' in the sample data page you'll understand my plight.

Dom

Daniel LaLiberte

unread,
Feb 9, 2015, 12:14:42 PM2/9/15
to google-visua...@googlegroups.com
Dom,

I tried going to the page you linked to, but got a couple rather severe warnings before it continued loading: 

Warning: include(functions/shortalerts): failed to open stream: No such file or directory in /home/content/48/10114148/html/wp-content/themes/ifeaturepro5-child03/header.php on line 4

Warning: include(): Failed opening 'functions/shortalerts' for inclusion (include_path='.:/usr/local/php5_4/lib/php') in /home/content/48/10114148/html/wp-content/themes/ifeaturepro5-child03/header.php on line 4

Perhaps you are working on it.  Then I enter GOOG in the search box, and I get a permission problem:
"You do not have the appropriate group permissions to access this page."


In any event, you probably should load only your most refined data and use the data.group() function multiple times to construct a DataTable for each way you do the grouping.  You will want to do aggregation using the sum function.  See:


Maybe you can also save more time by generating each aggregation from the previous, assuming they contain the right values, rather than restarting with the most refined data each time.

Also, I recommend starting with the simplest case first, figuring out where your performance problems are and fixing that before adding more complexity.


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA

Dominick LaViola

unread,
Feb 24, 2015, 8:59:56 PM2/24/15
to google-visua...@googlegroups.com
Thank you for the response. It seems most of the problems during this time, prior and since, are due to a notorious hack that I cant comment on as it is under investigation. The crux of the problem being someone has tethered themselves to the server to steal the data, perhaps attempting to reverse engineer the program files they stole mid January.

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/WzCSbGLfYdY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.

Dominick LaViola

unread,
Aug 1, 2017, 1:10:55 PM8/1/17
to google-visua...@googlegroups.com
Hi Dan.

I was looking through my emails and saw this conversation. I realized there is so much that has happened I ought to at least give you the bullet points since last we conversed....

The hacker of my site, and as it turns out my life, is a man named Rob Karas ...He calls himself Stasva because he is the new American version of the Stasi..

if you ever want to know the truth do a Google search for DHS Stasi.

Homeland Security was built by an ex Stasi leader named Markus Wolfe and a KGB officer. It might. e better that you remain oblivious to that fact.

GoDaddy CEO Blake Irvng is the son of a famous and former FBI agent..so when Karas showed up claiming to have 17 years of Federal law enforcement experience and requested unfettered access to my everything ..he got it.

Karas has no Federal law enforcement experience...

He heads up a group called NCATS under NCCIC at DHS. They supposedly perform PENETRATION TESTING and exist to strengthen our nations cyber security..but they don't do that.

see the attached image or go to github.com/dhs-ncats/ and you'll see the statement: 

"We hack governments and others to improve cyber hygiene."

Governments...plural..and not gov't systems mind you.

and others...others like me and anyone else that threatens the status quo or publishes market data Wall Street would rather keep for themselves as I do. We are all fair game to them and let me tell you...

They stole my money...they had me kicked out of my house onto the street as if I had no contract of sale and was not current on my payments as a squatter with no right to occupancy.

They had my utilities cut off, car insurance cancelled, patent application killed before it was processed and subpoenaed me to court to waste my time by hacking the local clerk's office and so much more I cannot begin to tell you.

They hacked my website hundreds of times..

" to improve cyber hygiene."...not cyber security..its like cyber ethnic cleansing. 

porn is okay because people watching it are not starting trouble...me..well my sentence is death by forced suicide.

see this link and the attached images and you'll know what i mean:

in a whistleblower waiting for an award determination worth up to $28 million or more...and its 8 months late and I can tell you there was a time I would not have believed any of this...but I can tell you that everything described and much more has been done to me...



the Michael person described is Rob Karas.  

I could prove it to you. the idiot joined my site from DHS and paid by credit card...the IP address matches the hacker in Georgia because he was trying to destroy evidence of the hit on me there..

it got spun into an election attack by Georgia's Sec. of State so DHS invented the DNC hack by Russians to divert media attention..

it worked perfectly...

you want to know more ill tell you...ill prove it to you if need be..I can't get any help. I guess if I'm honest I'm just hoping someone will hear me at this point and believe me. no one does....denial is a better thing to live with I guess

To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/WzCSbGLfYdY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Screenshot_2017-07-18-13-11-01.png
KIMG0010.JPG
IMG_20170103_224543.jpg

Daniel LaLiberte

unread,
Aug 1, 2017, 2:50:24 PM8/1/17
to Google Visualization API, Daniel LaLiberte
Hi Dom,

Thanks for writing.  Probably would be best if we continue this on my personal email rather than my google account.  CCing that address.


To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsubscr...@googlegroups.com.

To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/WzCSbGLfYdY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsubscr...@googlegroups.com.

To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages