Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: word cloud visualization #1067

Merged
merged 2 commits into from
Jun 13, 2016

Conversation

anthony-coble
Copy link

This PR adds a word cloud visualization.

The word cloud itself is provided by https://github.com/jasondavies/d3-cloud. This pr integrates it into a redash visualization.

image

@arikfr
Copy link
Member

arikfr commented May 23, 2016

Thanks!
Please see comments.

@@ -0,0 +1,505 @@
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g=(g.d3||(g.d3 = {}));g=(g.layout||(g.layout = {}));g.cloud = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding the cloud.js file to the repo, let's install it with Bower. If you need instructions on how to do that, let me know and I will guide you through.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah going to need some help with this. I haven't been able to figure out these js package systems.

I modified line 11 below from:

module.exports = function() {

Because I couldn't figure out how to reference this module. I'm not sure where that module structure even comes from D3, Angular? Been digging into both but not finding any docs that have been illuminating yet.

I did find the bower docs and add d3-cloud this to the rd_ui/bower.json but can't figure out how to reference it.

I tried var cloud = require("d3-cloud") but that is throwing up errors: angular.js:9937 ReferenceError: require is not defined

Directly referencing module.exports in the same way seems like a mistake.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arikfr Don't know if you saw this. I made the rest of your requested changes, but I'm not sure how to get this working correctly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saw it but didn't have the chance to follow up with proper instructions, as I need to test if it's possible to use the d3cloud package as a script tag without a module loader. I will do it during the weekend...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it expects the using project to utilize some sort of a module loader, which we currently don't. I guess we will have to bundle it (as you did) until we do use a module loader...

Let's just move this file to rd_ui/app/scripts/vendor.

@arikfr arikfr changed the title Add a word cloud visualization Feature: word cloud visualization May 23, 2016
@anthony-coble
Copy link
Author

@arikfr cloud.js moved and edits made.

@arikfr arikfr merged commit 790128c into getredash:master Jun 13, 2016
@arikfr
Copy link
Member

arikfr commented Jun 13, 2016

Merged. Thanks!

@arikfr
Copy link
Member

arikfr commented Jun 13, 2016

(and sorry for the delay)

simo7 pushed a commit to pubnative/redash that referenced this pull request Sep 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants