This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ReportGrid.leaderBoard("#chart1",{ | |
| axes: ["product","sales"], | |
| load: ReportGrid.query.precog(leaderBoardQuery).sortValue("sales").reverse() | |
| }); | |
| ReportGrid.lineChart("#chart2",{ | |
| axes: ["month","quantity"], | |
| load: ReportGrid.query.precog(lineChartQuery).sortValue("month"), | |
| options: {displayrulemajor:true} | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data := //tutorial/transactions | |
| dataWithHour := data with | |
| {hour: std::time::hourOfDay(data.timeStamp)} | |
| aveSalesByHour :=solve 'source, 'hour | |
| data' := dataWithHour where dataWithHour.source = 'source & dataWithHour.hour = 'hour | |
| {source: 'source, | |
| averageSales: sum(data'.total), | |
| hour: 'hour} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import std::time::* | |
| data := //tutorial/transactions | |
| today := 233 | |
| dataWithMonthAndYearAndDay := data with | |
| {month: monthOfYear(data.timeStamp), | |
| year: year(data.timeStamp), | |
| day: dayOfYear(data.timeStamp)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data := //tutorial/transactions | |
| salesByProduct := solve 'product | |
| {product: 'product, | |
| sales: sum(data.total where | |
| data.ApocalypseProducts = 'product)} | |
| rank := std::stats::rank(neg salesByProduct.sales) | |
| salesByProduct where rank <= 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require_once("Precog.php"); | |
| $api = new PrecogAPI("yourAPI keyHere", | |
| "your rootPath", | |
| "http://beta.precog.com/"); | |
| $db = new PDO('sqlite:nimbleData.db'); | |
| $rows = $db->query('SELECT * FROM Users', PDO::FETCH_ASSOC); | |
| $counter = 0; | |
| foreach($rows as $row){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require_once("Precog.php"); | |
| $api = new PrecogAPI("yourAPI key", | |
| "your rootPath", | |
| "http://beta.precog.com/"); | |
| $api->ingest("/path/to/store/data", | |
| "dataToUpload.json", | |
| "json"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require_once("Precog.php"); | |
| $api = new PrecogAPI("yourAPI key here", | |
| "your rootPath here", | |
| "http://beta.precog.com/"); | |
| date_default_timezone_set('UTC'); | |
| $datetime = new DateTime(); | |
| $datetime->format(DateTime::ISO8601); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var addedToShoppingCart = { | |
| timeStamp: +new Date(), | |
| durationOfPageView: 220.3, | |
| productIDAdded: "EFXZ40-1248-9933", | |
| otherProductsInCart: ["APLW40-1248-8821"], | |
| country: "US", | |
| state: "CO" | |
| }; | |
| Precog.store("/path/to/store/data", addedToShoppingCart, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Instrument Your Data</title> | |
| <script src="http://api.reportgrid.com/js/precog.js?apiKey=yourAPIKEY&analyticsService=beta2012v1.precog.com/v1"> | |
| <script> | |
| function init() { | |
| document.getElementById("button").onclick = function() { | |
| var date = new Date(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(){ | |
| var params = ReportGrid.parseQueryParameters(ReportGrid.findScript('arrows.json.js').src), | |
| handler = params['callback']; | |
| window[handler]( | |
| {"type": "FeatureCollection","features": [ | |
| {"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-105.390027, 40.063935], [-73.996328, 40.750422]]}}, | |
| {"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-105.390027, 40.063935], [-122.727802, 37.784827]]}}, | |
| {"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[-105.390027, 40.063935], [ -90.196781,38.633232]]}} | |
| ]} |
NewerOlder