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