├── .gitignore
├── sketch-data-studio-free.sketchplugin
└── Contents
│ └── Sketch
│ ├── genTables
│ ├── rand01.js
│ ├── randBond.js
│ ├── randStock.js
│ ├── randSymbol.js
│ ├── rand0100.js
│ └── randArb.js
│ ├── csvUpload
│ └── importCSVToTable.js
│ ├── genCharts
│ ├── barChart.js
│ └── lineChart.js
│ ├── globals
│ ├── chartColors.js
│ ├── symbols.js
│ ├── dataTypes.js
│ ├── chartTypes.js
│ └── names.js
│ ├── functions
│ └── inputs.js
│ ├── manifest.json
│ └── controllers
│ ├── genChart.js
│ └── genTable.js
├── README.md
└── LICENSE
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/genTables/rand01.js:
--------------------------------------------------------------------------------
1 | var onRun = function(context) {
2 | var doc = context.document;
3 | var dt = 'zeroToOne';
4 |
5 | @import '../controllers/genTable.js';
6 | }
7 |
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/genTables/randBond.js:
--------------------------------------------------------------------------------
1 | var onRun = function(context) {
2 | var doc = context.document;
3 | var dt = 'bond';
4 |
5 | @import '../controllers/genTable.js';
6 | };
7 |
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/genTables/randStock.js:
--------------------------------------------------------------------------------
1 | var onRun = function(context) {
2 | var doc = context.document;
3 | var dt = 'stock';
4 |
5 | @import '../controllers/genTable.js';
6 | };
7 |
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/genTables/randSymbol.js:
--------------------------------------------------------------------------------
1 | var onRun = function(context) {
2 | var doc = context.document;
3 | var dt = 'symbol';
4 |
5 | @import '../controllers/genTable.js'
6 | };
7 |
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/csvUpload/importCSVToTable.js:
--------------------------------------------------------------------------------
1 | var onRun = function(context) {
2 | var doc = context.document;
3 | var dt = 'fromCSV';
4 |
5 | @import '../controllers/genTable.js'
6 | };
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/genCharts/barChart.js:
--------------------------------------------------------------------------------
1 | var onRun = function(context) {
2 | var doc = context.document;
3 | var dt = 'barSeries';
4 |
5 | @import '../controllers/genChart.js';
6 | };
7 |
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/genCharts/lineChart.js:
--------------------------------------------------------------------------------
1 | var onRun = function(context) {
2 | var doc = context.document;
3 | var dt = "lineSeries";
4 |
5 | @import '../controllers/genChart.js';
6 | };
7 |
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/genTables/rand0100.js:
--------------------------------------------------------------------------------
1 | var onRun = function(context) {
2 | var doc = context.document;
3 | var dt = 'zeroToHundred';
4 |
5 | @import '../controllers/genTable.js'
6 | };
7 |
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/genTables/randArb.js:
--------------------------------------------------------------------------------
1 | var onRun = function(context) {
2 | var doc = context.document;
3 | var dt = 'arbitrary';
4 |
5 | @import '../controllers/genTable.js';
6 | };
7 |
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/globals/chartColors.js:
--------------------------------------------------------------------------------
1 | var chartColors = [
2 | '#1f77b4',
3 | '#ff7f0e',
4 | '#2ca02c',
5 | '#d62728',
6 | '#9467bd',
7 | '#8c564b',
8 | '#e377c2',
9 | '#7f7f7f',
10 | '#bcbd22',
11 | '#17becf'
12 | ];
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/globals/symbols.js:
--------------------------------------------------------------------------------
1 | var stockSymbols = [
2 | "CBST",
3 | "SAEX",
4 | "XLRN",
5 | "CALA",
6 | "MTEX",
7 | "CEMP",
8 | "TTPH",
9 | "KE",
10 | "MDGN",
11 | "PRTK",
12 | "AKBA",
13 | "LPX",
14 | "VTSS",
15 | "ISIS",
16 | "VCYT",
17 | "VIMC",
18 | "HQY",
19 | "BLUE",
20 | "AGEN",
21 | "GERN",
22 | "ALNY",
23 | "AMCN",
24 | "XOMA",
25 | "GV",
26 | "DMD",
27 | "PTCT",
28 | "IDRA",
29 | "FBP",
30 | "GLUU",
31 | "HABT",
32 | "CSLT",
33 | "DPLO",
34 | "JRJC",
35 | "INCR",
36 | "CISG",
37 | "MZOR",
38 | "VTAE",
39 | "SAND",
40 | "TXTR",
41 | "FGEN",
42 | "HRTG",
43 | "HCI",
44 | "EYES",
45 | "FPRX",
46 | "ALDR",
47 | "KMDA",
48 | "CGEN",
49 | "SBGL",
50 | "ADXS",
51 | "NUS",
52 | "UTHR",
53 | "NLS",
54 | "LIOX",
55 | "CDZI",
56 | "SIGM",
57 | "UIHC",
58 | "IMMU",
59 | "CLDN",
60 | "BIG",
61 | "PCTY",
62 | "CELG",
63 | "EXAS",
64 | "RLYP",
65 | "FOR",
66 | "FNHC",
67 | "ACAD",
68 | "DGII",
69 | "IAG",
70 | "INSY",
71 | "MDCA",
72 | "GOLD",
73 | "ZNH",
74 | "AEO",
75 | "CORT",
76 | "GCO",
77 | "TPUB",
78 | "TREC",
79 | "FSGI",
80 | "UVE",
81 | "AGIO",
82 | "INCY",
83 | "MCY",
84 | "AUY",
85 | "MMSI",
86 | "ONE",
87 | "MDCO",
88 | "ATHN",
89 | "AUQ",
90 | "EGO",
91 | "FRPT",
92 | "BMRN",
93 | "BBY",
94 | "STML",
95 | "FRAN",
96 | "RYAM",
97 | "BDR",
98 | "EW",
99 | "LPTN",
100 | "BIND",
101 | "PRQR"
102 | ];
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/functions/inputs.js:
--------------------------------------------------------------------------------
1 | function askForInput(title, type, dt) {
2 | var alert = [COSAlertWindow new];
3 | [alert setMessageText: title];
4 |
5 | var optionsView = [[NSView alloc] initWithFrame: NSMakeRect(0, 0, 300, 85)];
6 | [alert addAccessoryView: optionsView];
7 |
8 | var numItemsText = 'Number of ' + (type == 'charts' ? 'charts' : 'columns');
9 | var numLabel = addLabel(numItemsText, NSMakeRect(0, 65, 200, 20));
10 | [optionsView addSubview: numLabel];
11 |
12 | var numInput = addInput(1, NSMakeRect(130, 65, 50, 20));
13 | [optionsView addSubview: numInput];
14 |
15 | var numPointsText = 'Number of ' + (type == 'charts' ? 'points' : 'rows');
16 | var pointsLabel = addLabel(numPointsText, NSMakeRect(0, 35, 200, 20));
17 | [optionsView addSubview: pointsLabel];
18 |
19 | var pointsInput = addInput(10, NSMakeRect(130, 35, 50, 20));
20 | [optionsView addSubview: pointsInput];
21 |
22 | // add bottom buttons
23 | [alert addButtonWithTitle:"Generate"];
24 | [alert addButtonWithTitle:"Cancel"];
25 |
26 | var arbitraryInput;
27 |
28 | log(dt);
29 | if(dt == 'arbitrary') {
30 | var arbitraryText = 'Arbitrary values';
31 | var arbitraryLabel = addLabel(arbitraryText, NSMakeRect(0,5, 150, 20));
32 | [optionsView addSubview: arbitraryLabel];
33 |
34 | arbitraryInput = addInput('', NSMakeRect(130,5,150,20));
35 | [optionsView addSubview: arbitraryInput];
36 | }
37 |
38 | var input = [alert runModal];
39 |
40 | return {
41 | items: numInput,
42 | points: pointsInput,
43 | arb: arbitraryInput,
44 | result: input
45 | };
46 |
47 | function addLabel(optionValue, frame) {
48 |
49 | var label = [[NSTextField alloc] initWithFrame: frame];
50 | [label setStringValue: optionValue];
51 | [label setBezeled:false];
52 | [label setDrawsBackground:false];
53 | [label setEditable:false];
54 | [label setSelectable:false];
55 |
56 | return label;
57 | }
58 |
59 | function addInput(defaultValue, frame) {
60 |
61 | var input = [[NSTextField alloc] initWithFrame: frame];
62 | [input setStringValue: defaultValue];
63 | [input setBezeled:true];
64 | [input setDrawsBackground:true];
65 | [input setEditable:true];
66 | [input setSelectable:true];
67 |
68 | return input;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Sketch Data Studio Free",
3 | "description": "Plugin to import data from CSV to generate tables and charts. Also generate random data for charts.",
4 | "author": "Tyler Wolf",
5 | "homepage": "http://thetylerwolf.github.io/sketch-data-studio",
6 | "version": 1.0,
7 | "identifier": "com.tylerwolf.sketch.sketch-data-studio",
8 | "compatibleVersion": 3,
9 | "bundleVersion": 1,
10 | "commands": [
11 | {
12 | "name": "Import CSV to Table",
13 | "identifier": "csvToTable",
14 | "script": "csvUpload/importCSVToTable.js"
15 | },
16 | {
17 | "name": "Bar Chart",
18 | "identifier": "barChart",
19 | "script": "genCharts/barChart.js"
20 | },
21 | {
22 | "name": "Line Chart",
23 | "identifier": "lineChart",
24 | "script": "genCharts/lineChart.js"
25 | },
26 | {
27 | "name": "Random 0 - 1",
28 | "identifier": "rand01",
29 | "script": "genTables/rand01.js"
30 | },
31 | {
32 | "name": "Random 0 - 100",
33 | "identifier": "rand0100",
34 | "script": "genTables/rand0100.js"
35 | },
36 | {
37 | "name": "Random Bond",
38 | "identifier": "randBond",
39 | "script": "genTables/randBond.js"
40 | },
41 | {
42 | "name": "Random Stock Symbols",
43 | "identifier": "randStockSymbol",
44 | "script": "genTables/randSymbol.js"
45 | },{
46 | "name": "Random Stocks",
47 | "identifier": "randStock",
48 | "script": "genTables/randStock.js"
49 | },{
50 | "name": "Set Your Own Random Values",
51 | "identifier": "randArb",
52 | "script": "genTables/randArb.js"
53 | }
54 | ],
55 | "menu": {
56 | "title": "Sketch Data Studio Free",
57 | "items": [
58 | {
59 | "title": "CSV Upload",
60 | "items": [
61 | "csvToTable"
62 | ]
63 | },
64 | {
65 | "title": "Generate Chart",
66 | "items": [
67 | "barChart",
68 | "lineChart"
69 | ]
70 | },
71 | {
72 | "title": "Generate Table",
73 | "items": [
74 | "rand01",
75 | "rand0100",
76 | "randBond",
77 | "randStockSymbol",
78 | "randStock",
79 | "randArb"
80 | ]
81 | }
82 | ]
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Sketch Data Studio
2 | ==================
3 |
4 | A Sketch plugin to upload or generate numerical and qualitative data for charts and tables. Ideal for those working on big data interfaces or for data scientists who want charts that look better than those produced by spreadsheet software. Updated frequently.
5 |
6 | #### Go Premium
7 | Premium version enables generating Charts from imported CSV data, as well as more chart types to choose from.
8 | #### [Go Premium!](http://thetylerwolf.github.io/sketch-data-studio)
9 |
10 | 
11 |
12 | ## Compatibility
13 | Sketch v41 and later only!
14 |
15 | ## How to use
16 | Enter number of columns, followed by number of rows or number of charts (comma separated) and you're done.
17 |
18 | ## Data Types
19 | ##### *Random 0 - 1*
20 | A random floating point number from 0 - 1
21 |
22 | ##### *Random 0 - 100*
23 | A random floating point number from 0 - 100
24 |
25 | ##### *Set your own random values*
26 | Input a comma-separated list of values that will be picked at random for each row. This can be used to select random integers (1,2,3,4...)
27 |
28 | ##### *Random Stocks*
29 | Stock names randomly chosen from a list of stocks that were found on the internet.
30 |
31 | ##### *Random Bonds*
32 | Bond names randomly chosen from a list of stocks that were found on the internet, then a random number between 1 and 10 is chosen and concatenated with the letters "YR" (e.g. 1YR, 4YR, etc.)
33 |
34 | ##### *Random Stock Symbols*
35 | Stock ticker symbols randomly chosen from a list of stocks that were found on the internet.
36 |
37 | ## *CSV Import*
38 | Save a spreadsheet in **.csv** format and import it through the dialogue. Only files with a **.csv** or **.CSV** extension will be import-able.
39 |
40 | #### *Tables*
41 | Any data should work.
42 |
43 | #### *FAQ*
44 | **Q**: My imported CSV data comes in with a weird format/I get an error when uploading CSV!
45 | **A**: Make sure your file is correctly formatted (utf-8). If you're not sure what that means, try the following:
46 | Upload your CSV file to Google Docs
47 | Download the file as a CSV
48 | Try with the newly downloaded file
49 |
50 | ## Bug reporting
51 | Please include your OS X version as well as your Sketch version in any bug reports.
52 |
53 | ## Disclaimer
54 | All data labeled "Random" is completely random and is not useful for any sort of financial planning. Data is for mock-up/demo purposes only.
55 |
56 | Made by [Tyler Wolf](http://www.tylernwolf.com)
57 |
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/controllers/genChart.js:
--------------------------------------------------------------------------------
1 | @import '../functions/inputs.js'
2 | @import '../globals/chartTypes.js'
3 |
4 | var input, values,
5 | firstChoices, group, points,
6 | seriez, seriesLayer, seriesArray;
7 | var sLoc;
8 |
9 |
10 | input = askForInput(chartTypes[dt].name, 'charts');
11 | if(input.result == 1001) return;
12 |
13 | points = Math.abs(input.points.intValue()) || 1;
14 | seriez = Math.abs(input.items.intValue()) || 1;
15 |
16 | group = [MSLayerGroup new];
17 |
18 | //If we're using artboards, add to the current artboard
19 | if(doc.currentPage().artboards().count() > 0) {
20 | var currentArtboard = doc.currentPage().currentArtboard();
21 | // group = currentArtboard.addLayerOfType('group');
22 |
23 | currentArtboard.addLayers([group]);
24 | } else {
25 | doc.currentPage().addLayers([group]);
26 | }
27 |
28 | group.setName('chart');
29 | group.frame().x = 100;
30 | group.frame().y = 100;
31 | group.frame().height = 120 * seriez;
32 | if(/bar|Bar/.test(dt)) {
33 | group.frame().width = (points * 30) - 10;
34 | } else if(/line|Line/.test(dt)) {
35 | group.frame().width = (points * 10);
36 | }
37 |
38 |
39 | for(i=seriez; i>0; i--) {
40 | var seriesGroup = [MSLayerGroup new];
41 | group.addLayers([seriesGroup]);
42 |
43 | seriesGroup.setName('series');
44 |
45 | seriesArray = genSeries(points, i, dt);
46 | sizeGroup(seriesGroup,seriesArray,i);
47 | // I'll use sLoc later, I swear it.
48 | sLoc = generateChart(seriesArray,i,seriesGroup);
49 |
50 | }
51 |
52 | function sizeGroup(seriesGroup, seriesArray, i) {
53 | var maxPoint = Math.max.apply(Math,seriesArray);
54 | var minPoint = Math.min.apply(Math,seriesArray);
55 |
56 | seriesGroup.frame().x = 0;
57 | seriesGroup.frame().y = 120*(i - 1);
58 |
59 | seriesGroup.frame().height = maxPoint - (minPoint < 0 ? minPoint : 0);
60 |
61 | if(/bar|Bar/.test(dt)) {
62 | seriesGroup.frame().width = (points * 30) - 10;
63 | } else if(/line|Line/.test(dt)) {
64 | seriesGroup.frame().width = (points * 10);
65 | }
66 | }
67 |
68 |
69 | function genSeries(numSeries, index, dt) {
70 | var result = [],
71 | num;
72 |
73 | for(var i = numSeries; i>0; i--) {
74 | num = chartTypes[dt].val(index, values);
75 | result.push(num);
76 | }
77 |
78 | return result;
79 | }
80 |
81 | function generateChart(sArray,i, group) {
82 | return chartTypes[dt].generate(sArray,i,group);
83 | }
84 |
85 | function isText(layer) {
86 | return layer.isMemberOfClass(MSTextLayer);
87 | }
88 |
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/controllers/genTable.js:
--------------------------------------------------------------------------------
1 | @import '../functions/inputs.js';
2 | @import '../globals/names.js';
3 | @import '../globals/symbols.js';
4 | @import '../globals/dataTypes.js';
5 |
6 | var input, values,
7 | firstChoices, group, rows,
8 | cols, textLayer;
9 |
10 | if(dt == 'fromCSV') {
11 | values = importFromCSV();
12 | if(values == false) return;
13 | } else {
14 | //First input
15 | input = askForInput(dataTypes[dt].name, 'tables', dt);
16 | if(input.result == 1001) return;
17 |
18 | rows = Math.abs(input.points.intValue()) || 1;
19 | cols = Math.abs(input.items.intValue()) || 1;
20 |
21 | if(dt == 'arbitrary') {
22 | var arbValues = input.arb.stringValue()
23 | arbValues = arbValues.split(',');
24 | values = arbValues.map(function(d) { return d.trim(); });
25 | }
26 |
27 | }
28 | //If we're using artboards, add to the current artboard
29 | group = [MSLayerGroup new];
30 |
31 | //If we're using artboards, add to the current artboard
32 | if(doc.currentPage().artboards().count() > 0) {
33 | var currentArtboard = doc.currentPage().currentArtboard();
34 | // group = currentArtboard.addLayerOfType('group');
35 |
36 | currentArtboard.addLayers([group]);
37 | } else {
38 | doc.currentPage().addLayers([group]);
39 | }
40 |
41 | group.setName('columns');
42 |
43 | if(dt !== 'fromCSV') {
44 |
45 | for(i=cols; i>0; i--) {
46 | textLayer = [MSTextLayer new];
47 | group.addLayers([textLayer]);
48 | genRows(rows, textLayer, i, dt);
49 | }
50 |
51 | } else {
52 |
53 | for(i=0; i0; i--) {
71 | num = dataTypes[dt].val(index, values);
72 | result.push(num);
73 | }
74 |
75 | resultStr = result.join('\n');
76 | layer.setStringValue(resultStr);
77 | layer.adjustFrameToFit();
78 | placeLayer(layer, index);
79 | }
80 |
81 | function placeLayer(layer, index) {
82 | layer.frame().setX(index * 100);
83 | refreshTextLayer(layer);
84 | }
85 |
86 | function isText(layer) {
87 | return layer.isMemberOfClass(MSTextLayer);
88 | }
89 |
90 | function importFromCSV() {
91 | var path = dataTypes[dt].prompt();
92 | if(!path) return false;
93 |
94 | //get root dir
95 | // var rootDir = [path stringByDeletingLastPathComponent];
96 | // if(!Sandbox.authoriseDir(rootDir)) return;
97 |
98 | var contents = dataTypes[dt].load(path);
99 |
100 | var data = dataTypes[dt].transform(contents);
101 | cols = data.length;
102 |
103 | return data;
104 | }
105 |
106 | // Taken from Sketch Data Populator - Thanks!
107 | // https://github.com/preciousforever/sketch-data-populator
108 | function refreshTextLayer(layer) {
109 | [layer select: true byExpandingSelection: false];
110 | [layer setIsEditingText: true];
111 | [layer setIsEditingText: false];
112 | [layer select: false byExpandingSelection: false];
113 | }
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/globals/dataTypes.js:
--------------------------------------------------------------------------------
1 | var dataTypes = {
2 | zeroToOne : {
3 | name: 'Random 0 - 1',
4 | val: function() {
5 | var rand = Math.random();
6 | rand = rand.toFixed(2).toString();
7 | return rand;
8 | }
9 | },
10 | zeroToHundred : {
11 | name: 'Random 0 - 100',
12 | val: function() {
13 | var rand = Math.random() * 100;
14 | rand = rand.toFixed(2).toString();
15 | return rand;
16 | }
17 | },
18 | arbitrary : {
19 | name: 'Set your own random values',
20 | val: function(index, values) {
21 | var pickNum = values.length;
22 | var rand = Math.random() * values.length;
23 | rand = Math.floor(rand);
24 | return values[rand];
25 | }
26 | },
27 | stock : {
28 | name: 'Random Stocks',
29 | val: function() {
30 | var rand = Math.random() * stockNames.length;
31 | rand = Math.ceil(rand);
32 | return stockNames[rand-1];
33 | }
34 | },
35 | bond : {
36 | name: 'Random Bonds',
37 | val: function() {
38 | var rand = Math.random() * stockNames.length;
39 | rand = Math.ceil(rand);
40 | var years = Math.random() * 10;
41 | years = Math.ceil(years);
42 | return stockNames[rand-1] + ' ' + years + 'YR';
43 | }
44 | },
45 | symbol : {
46 | name: 'Random Stock Symbols',
47 | val: function() {
48 | var rand = Math.random() * stockSymbols.length;
49 | rand = Math.ceil(rand);
50 | return stockSymbols[rand-1];
51 | }
52 | },
53 | fromCSV : {
54 | name: 'Generate from CSV',
55 | prompt: function() {
56 | var panel = [NSOpenPanel openPanel];
57 |
58 | [panel setTitle: "Select File"];
59 | [panel setMessage: "Select the CSV file to use"];
60 | [panel setPrompt: "Choose"];
61 |
62 | [panel setCanCreateDirectories: false];
63 | [panel setCanChooseFiles: true];
64 | [panel setCanChooseDirectories: false];
65 | [panel setAllowsMultipleSelection: false];
66 | [panel setShowsHiddenFiles: false];
67 | [panel setExtensionHidden: false];
68 |
69 | var fileTypes = ['csv', 'CSV'];
70 | [panel setAllowedFileTypes:fileTypes];
71 |
72 | var pressedButton = [panel runModal];
73 | if(pressedButton == NSOKButton) {
74 | return [[panel URL] path];
75 | } else {
76 | return false;
77 | }
78 | },
79 | load: function(path) {
80 | var contents = [NSString stringWithContentsOfFile: path encoding: NSUTF8StringEncoding error: false];
81 |
82 | return contents;
83 | },
84 | transform: function(content) {
85 | content = content.replace(/\n\r/g,'\n');
86 | content = content.replace(/\r\n/g,'\n');
87 | content = content.replace(/\r/g,'\n');
88 | var data = content.split('\n');
89 |
90 | // data = data.map(function(d) { return d.split(','); });
91 |
92 | data = data.map(function(d) {
93 | var exp = new RegExp('["|""]','g');
94 | var string = d.replace(exp,',');
95 | string = string.split(',');
96 | return string;
97 | });
98 |
99 | data = data[0].map(function(d,i) {
100 | return data.map(function(j) {
101 | return j[i];
102 | });
103 | });
104 |
105 | return data;
106 | }
107 | }
108 | };
109 |
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/globals/chartTypes.js:
--------------------------------------------------------------------------------
1 | @import '../globals/chartColors.js'
2 |
3 | var chartTypes = {
4 | lineSeries : {
5 | name: 'Line Chart (Geometric Time Series)',
6 | val: function() {
7 | //Brownian time series for realism
8 | var direction = this.direction || Math.random() * 3 + -8;
9 | var prev = this.prev || Math.random() * 100;
10 | var rand = Math.random() * 10 + direction;
11 | var mean = 5;
12 | var vol = 5;
13 | var dt = 1;
14 |
15 | var result = (mean * dt) + (vol * rand * dt);
16 | this.prev = result + prev;
17 |
18 | return -this.prev.toFixed(2);
19 | },
20 | reset: function() {
21 | this.prev = undefined;
22 | },
23 | chartable: true,
24 | generate: function(pointsArray, index, group) {
25 | var avgPoint = pointsArray.reduce(function(a,b) {
26 | return a + b
27 | },0);
28 |
29 | var base = Math.max.apply(Math, pointsArray);
30 | var path = NSBezierPath.bezierPath();
31 |
32 | //initialize path
33 | var firstP = pointsArray[0];
34 |
35 | path.moveToPoint(NSMakePoint(0, base - firstP));
36 |
37 | //get rid of first point in series
38 | pointsArray.shift();
39 |
40 | var x;
41 | pointsArray.forEach(function(d,i) {
42 | x = (i + 1) * 10;
43 | path.lineToPoint(NSMakePoint(x, base - d));
44 | });
45 |
46 | var shape = MSShapeGroup.shapeWithBezierPath(path);
47 |
48 | var border = shape.style().addStylePartOfType(1);
49 |
50 | var idx = index % chartColors.length;
51 | var iColor = chartColors[idx];
52 | border.color = MSImmutableColor.colorWithSVGString(iColor);
53 | border.thickness = 2;
54 |
55 | group.addLayers([shape]);
56 |
57 | this.reset();
58 | }
59 | },
60 | barSeries : {
61 | name: 'Bar Chart (Random 1 - 100)',
62 | val: function() {
63 | var rand = Math.random() * 100 + 1;
64 | return rand.toFixed(2);
65 | },
66 | chartable: true,
67 | generate: function(va,index, group) {
68 | var base = Math.max.apply(Math, va);
69 | var height, width, x, y;
70 | height = width = x = y = 0;
71 |
72 | va.forEach(function(d,i) {
73 | var rect = MSRectangleShape.alloc().init();
74 |
75 | width = 20;
76 | x = i * 30;
77 |
78 | if(d < 0) {
79 | y = base;
80 | height = -d;
81 |
82 | } else {
83 | // Not sure why, but base goes to 0 when d == 0
84 | y = base - (d || 1);
85 | height = d || 1;
86 | }
87 |
88 | rect.frame = MSRect.rectWithRect(NSMakeRect(x,y,width,height));
89 |
90 | rect = MSShapeGroup.shapeWithPath(rect);
91 |
92 | rect.setName('bar');
93 |
94 | var rectFill = rect.style().addStylePartOfType(0);
95 |
96 | var idx = index % chartColors.length;
97 | var iColor = chartColors[idx];
98 | rectFill.color = MSImmutableColor.colorWithSVGString(iColor);
99 |
100 | rect.frame().constrainProportions = false;
101 |
102 | width = rect.frame().x + rect.frame().width;
103 | height = Math.max(rect.frame().height, height);
104 | group.addLayers([rect])
105 | });
106 |
107 | return {
108 | w: width,
109 | h: height,
110 | x: x,
111 | y: base
112 | }
113 |
114 | }
115 | }
116 | };
117 |
--------------------------------------------------------------------------------
/sketch-data-studio-free.sketchplugin/Contents/Sketch/globals/names.js:
--------------------------------------------------------------------------------
1 | var stockNames = [
2 | "Mol Global Inc.",
3 | "Digital Ally",
4 | "Image Sensing Systems",
5 | "Spansion Inc",
6 | "Viggle Inc.",
7 | "Shoe Carnival",
8 | "Cypress Semiconductor Corp",
9 | "Ring Energy Inc",
10 | "Idera Pharmaceuticals",
11 | "Avanir Pharmaceuticals Inc",
12 | "Immune Pharmaceuticals Inc.",
13 | "Digimarc Corp",
14 | "ANI Pharmaceuticals Inc",
15 | "Valero Energy Partners LP",
16 | "Pozen Inc",
17 | "Lakeland Industries",
18 | "Callon Petroleum Company",
19 | "Alpha Pro Tech",
20 | "Aerie Pharmaceuticals Inc",
21 | "Taser International",
22 | "North Atlantic Drilling Ltd. Co",
23 | "Jd.Com Inc.",
24 | "Covisint Corp",
25 | "Dycom Industries",
26 | "E2Open Inc",
27 | "Memorial Production Partners LP",
28 | "Greenbrier Companies",
29 | "Seadrill Partners Llc",
30 | "Tg Therapeutics",
31 | "Phillips 66 Partners LP",
32 | "Planar Systems",
33 | "Sequenom Inc",
34 | "Ptc Therapeutics Inc",
35 | "Karyopharm Therapeutics Inc",
36 | "Englobal Corp",
37 | "Shell Midstream Partners L.P.",
38 | "Tetraphase Pharmaceuticals Inc",
39 | "Amyris Inc",
40 | "Enphase Energy Inc",
41 | "Dynavax Technologies Corp",
42 | "Ev Energy Partners L.P.",
43 | "Magnum Hunter Resources Corp",
44 | "Atlas Pipeline Partners L.P.",
45 | "Nanometrics Inc",
46 | "The Bancorp",
47 | "Truecar Inc.",
48 | "Energy Xxi [Bermuda] Limited",
49 | "Turquoise Hill Resources Ltd",
50 | "Sportsman'S Warehouse Holdi",
51 | "Teekay Shipping Corp",
52 | "Flamel Technologies S.A.",
53 | "Magal Security Systems Ltd",
54 | "China Life Insurance Company Limited",
55 | "Textura Corp",
56 | "Raptor Pharmaceutical",
57 | "Limelight Networks",
58 | "Omnivision Technologies",
59 | "Fmsa Holdings Inc",
60 | "Harte-Hanks",
61 | "Dominion Midstream Partners LP",
62 | "Enable Midstream Partners LP",
63 | "Coherus Biosciences Inc.",
64 | "Breitburn Energy Partners L.P.",
65 | "Western Refining",
66 | "Sophiris Bio Inc",
67 | "Achillion Pharmaceuticals",
68 | "Sky-Mobi Limited",
69 | "Renewable Energy Group Inc",
70 | "Golar Lng Partners LP",
71 | "Noah Holdings Ltd",
72 | "Boardwalk Pipeline Partners L.P.",
73 | "Nevro Corp",
74 | "Ligand Pharmaceuticals Inc",
75 | "Biogen Idec Inc",
76 | "Oneok Partners L.P.",
77 | "Idreamsky Technology Ltd",
78 | "Mplx LP",
79 | "Royal Caribbean Cruises Ltd",
80 | "Stealthgas",
81 | "USD Partners LP",
82 | "Acadia Pharmaceuticals Inc",
83 | "Neuralstem",
84 | "Allot Communications Ltd",
85 | "Safe Bulkers Inc",
86 | "Can-Fite Biopharma Ltd Sponsore",
87 | "Insmed Inc",
88 | "Customers Bancorp",
89 | "Ngl Energy Partners LP",
90 | "Tripadvisor Inc",
91 | "Soufun Holdings",
92 | "Formfactor",
93 | "Advanced Energy Industries",
94 | "Powersecure International Inc",
95 | "Liberty Tripadvisor Holdings I",
96 | "Retractable Technologies",
97 | "Travelcenters of America Llc",
98 | "Nustar Energy L.P.",
99 | "Isle of Capri Casinos",
100 | "Equity Midstream Partners LP",
101 | "Hi-Crush Partners LP",
102 | "Gran Tierra Energy Inc",
103 | "Targa Resources",
104 | "Straight Path Communications In",
105 | "Golar Lng Limited",
106 | "Lrr Energy L.P.",
107 | "Teekay Tankers Ltd",
108 | "The Exone Company",
109 | "Smart",
110 | "King Digital Entertainment Plc",
111 | "Synergy Resources Cp",
112 | "Hydrogenics Corp",
113 | "Dcp Midstream Partners LP",
114 | "Buckeye Partners L.P.",
115 | "Rocket Fuel Inc.",
116 | "Audiovox Corp",
117 | "Clayton Williams Energy",
118 | "Qunar Cayman Islands Limited",
119 | "Comscore Inc",
120 | "Delek US Holdings",
121 | "Sizmek Inc.",
122 | "Cyberark Software Ltd.",
123 | "Whiting USA Trust II",
124 | "Cheniere Energy Partners LP",
125 | "Himax Technologies",
126 | "AK Steel Holding Corp",
127 | "National Bank of Greece Sa",
128 | "Rada Electronics Industries Limited",
129 | "Just Energy Group Inc",
130 | "World Wrestling Entertainment",
131 | "Ballard Power Systems",
132 | "Niska Gas Storage Partners Llc",
133 | "Richmont Mines",
134 | "Alliance Fiber Optic Products",
135 | "Tekmira Pharmaceuticals Corp",
136 | "JA Solar Holdings Co.",
137 | "Polypore International Inc",
138 | "Nuvasive Inc",
139 | "Mellanox Technologies",
140 | "Svb Financial Group",
141 | "Bluebird Bio Inc",
142 | "Canadian Solar Inc",
143 | "Marathon Petroleum Corp",
144 | "Methode Electronics",
145 | "NPS Pharmaceuticals",
146 | "Viewpoint Financial Group",
147 | "Abengoa Yield Plc",
148 | "Orexigen Therapeutics",
149 | "Yingli Green Energy Holding Company",
150 | "Transocean Partners Llc",
151 | "Sanmina-Sci Corp",
152 | "Pacific Biosciences of California",
153 | "PBF Energy Inc",
154 | "Antares Pharma",
155 | "Crestwood Midstream Partners LP",
156 | "Graftech International Ltd",
157 | "Emerge Energy Services LP Commo",
158 | "Atlas Resource Partners L.P. C",
159 | "Entravision Communications Corp",
160 | "Pembina Pipeline Cor",
161 | "Sanderson Farms",
162 | "Hong Kong Highpower Technology",
163 | "Orasure Technologies",
164 | "Acxiom Corp",
165 | "Wesco Aircraft Holdings Inc",
166 | "Southcross Energy Partners L.",
167 | "Cytokinetics Inc",
168 | "Penn National Gaming",
169 | "Novavax Inc",
170 | "Synergy Pharmaceuticals Inc",
171 | "Flexion Therapeutics Inc",
172 | "Amerigas Partners L.P.",
173 | "E-House [China] Holdings",
174 | "Aegerion Pharmaceuticals",
175 | "Futurefuel Corp",
176 | "Maxwell Technologies",
177 | "Rubicon Technology",
178 | "Voc Energy Trust",
179 | "Ocean Rig Udw Inc",
180 | "Lee Enterprises Inc",
181 | "Nustar Gp Holdings Llc",
182 | "Anacor Pharmaceuticals",
183 | "Tidewater Inc",
184 | "Jakks Pacific",
185 | "Ophthotech Corp",
186 | "Quantum Fuel Systems Technologies",
187 | "Xcerra Corp.",
188 | "Delek Logistics Partners LP",
189 | "Saia Inc",
190 | "Celldex Therapeutics Inc",
191 | "Weatherford International Ltd",
192 | "Willbros Group",
193 | "Jinkosolar Holding Company Limited",
194 | "Audience Inc",
195 | "Energy Recovery",
196 | "Itt Educational Services",
197 | "Theravance Biopharma Inc.",
198 | "Carbo Ceramics",
199 | "Harvest Natural Resources Inc",
200 | "Solazyme Inc",
201 | "Mid-Con Energy Partners LP"
202 | ]
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------