Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reportjs

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reportjs - npm Package Compare versions

Comparing version 1.3.0 to 2.0.1

dist/cjs/adapter/chartjsAdapter.js

8

bower.json
{
"name": "report.js",
"version": "1.3.0",
"version": "2.0.1",
"homepage": "https://github.com/youknowriad/report.js",

@@ -17,7 +17,3 @@ "authors": [

"Gruntfile.js"
],
"dependencies": {
"jquery": "~2.1.1",
"chartjs": "~1.0.1"
}
]
}
{
"name": "reportjs",
"version": "1.3.0",
"version": "2.0.1",
"description": "Report Library",
"repository": "https://github.com/BI-joe/report.js.git",
"main": "dist/reportjs.js",
"main": "dist/reportjs.cjs.js",
"directories": {

@@ -23,6 +23,11 @@ "test": "test"

"requirejs": "^2.1.11",
"traceur": "vojtajina/traceur-compiler#add-es6-pure-transformer-dist",
"gulp": "^3.8.10",
"gulp-traceur": "^0.14.1",
"vinyl-source-stream": "^1.0.0",
"es6ify": "~1.5.1",
"browserify": "~6.2.0"
},
"dependencies": {
"traceur": "vojtajina/traceur-compiler#add-es6-pure-transformer-dist"
}
}

@@ -21,4 +21,4 @@ import {Colors} from '../utils/colors';

renderGraphTo(element, graph) {
let getChartData = function(graph) {
renderGraphToCanvas(canvas, graph) {
let getChartData = function(graph) {
let index = 0,

@@ -45,4 +45,3 @@ colors = new Colors(),

element.prepend('<canvas width="'+getWidth(element, graph.width)+'" height="'+getHeight(element, graph.height)+'"></canvas>');
let context = element.find('canvas:first').get(0).getContext('2d'),
let context = canvas.getContext('2d'),
chart = new Chart(context),

@@ -56,11 +55,8 @@ chartOptions = {

chart = chart.Line(getChartData(graph), chartOptions);
element.append(chart.generateLegend());
break;
case 'bar':
chart = chart.Bar(getChartData(graph), chartOptions);
element.append(chart.generateLegend());
break;
case 'radar':
chart = chart.Radar(getChartData(graph), chartOptions);
element.append(chart.generateLegend());
break;

@@ -70,6 +66,8 @@ default:

}
return chart;
}
renderSegmentGraphTo(element, graph) {
let getChartData = function(graph) {
renderSegmentGraphToCanvas(canvas, graph) {
let getChartData = function(graph) {
let index = 0,

@@ -89,4 +87,3 @@ colors = new Colors(),

element.prepend('<canvas width="'+getWidth(element, graph.width)+'" height="'+getHeight(element, graph.height)+'"></canvas>');
let context = element.find('canvas:first').get(0).getContext('2d'),
let context = canvas.getContext('2d'),
chart = new Chart(context),

@@ -100,11 +97,8 @@ chartOptions = {

chart = chart.Pie(getChartData(graph), chartOptions);
element.append(chart.generateLegend());
break;
case 'polarArea':
chart = chart.PolarArea(getChartData(graph), chartOptions);
element.append(chart.generateLegend());
break;
case 'doughnut':
chart = chart.Doughnut(getChartData(graph), chartOptions);
element.append(chart.generateLegend());
break;

@@ -114,3 +108,19 @@ default:

}
return chart;
}
renderGraphTo(element, graph) {
element.prepend('<canvas width="'+getWidth(element, graph.width)+'" height="'+getHeight(element, graph.height)+'"></canvas>');
var canvas = element.find('canvas:first').get(0);
var chart = this.renderGraphToCanvas(canvas, graph);
element.append(chart.generateLegend());
}
renderSegmentGraphTo(element, graph) {
element.prepend('<canvas width="'+getWidth(element, graph.width)+'" height="'+getHeight(element, graph.height)+'"></canvas>');
var canvas = element.find('canvas:first').get(0);
var chart = this.renderSegmentGraphToCanvas(canvas, graph);
element.append(chart.generateLegend());
}
}

@@ -1,30 +0,11 @@

import {GridFactory} from './data/gridFactory';
import {TableRenderer} from './renderer/table/tableRenderer';
import {GraphRenderer} from './renderer/graph/graphRenderer';
import {SegmentGraphRenderer} from './renderer/graph/segmentGraphRenderer';
import {Renderer} from './renderer/renderer';
import {ChartjsAdapter} from './adapter/chartjsAdapter';
import {JQueryAdapter} from './adapter/jqueryAdapter';
export class Renderer {
var reportjs = {
Renderer: Renderer,
ChartjsAdapter: ChartjsAdapter,
JQueryAdapter: JQueryAdapter
};
renderTo(element, options) {
let gridFactory = new GridFactory(),
grid = gridFactory.buildFromJson(options.data);
if (options.layout.type === 'table') {
let tableRenderer = new TableRenderer(options.layout.rows, options.layout.columns, options.layout.options),
table = tableRenderer.render(grid);
element.html(table.getHtml());
} else if (options.layout.type === 'graph') {
let graphRenderer = new GraphRenderer(options.layout.datasets, options.layout.labels, options.layout.graphType, options.layout.height, options.layout.width),
graph = graphRenderer.render(grid),
adapter = new ChartjsAdapter();
adapter.renderGraphTo(element, graph);
} else if (options.layout.type === 'segmentGraph') {
let graphRenderer = new SegmentGraphRenderer(options.layout.graphType, options.layout.height, options.layout.width),
graph = graphRenderer.render(grid),
adapter = new ChartjsAdapter();
adapter.renderSegmentGraphTo(element, graph);
}
}
}
export {reportjs};

@@ -1,1 +0,1 @@

window.reportjs = require('../src/index.js');
window.reportjs = require('../src/index.js').reportjs;

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc