Showing 19 of 50 total issues
File chartkick.js
has 2018 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* Chartkick.js
* Create beautiful charts with one line of JavaScript
* https://github.com/ankane/chartkick.js
* v3.2.1
Function createDataTable
has 206 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var createDataTable = function (chart, options, chartType, library) {
var datasets = [];
var labels = [];
var colors = chart.options.colors || defaultColors;
Function setFormatOptions
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var setFormatOptions = function(chart, options, chartType) {
var formatOptions = {
prefix: chart.options.prefix,
suffix: chart.options.suffix,
thousands: chart.options.thousands,
Function formatValue
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function formatValue(pre, value, options, axis) {
pre = pre || "";
if (options.prefix) {
if (value < 0) {
value = value * -1;
Method registered
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.registered(app)
app.helpers Chartkick::Helper
app.get '/benchmarks/javascripts/chartkick.js' do
body = File.read File.join(JS_DIR, 'chartkick.js')
Function renderLineChart
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
defaultExport$1.prototype.renderLineChart = function renderLineChart (chart, chartType) {
chartType = chartType || "spline";
var chartOptions = {};
if (chartType === "areaspline") {
chartOptions = {
Function createDataTable
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
defaultExport$2.prototype.createDataTable = function createDataTable (series, columnType) {
var i, j, s, d, key, rows = [], sortedLabels = [];
for (i = 0; i < series.length; i++) {
s = series[i];
series[i].name = series[i].name || "Value";
Function addDownloadButton
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function addDownloadButton(chart) {
var element = chart.element;
var link = document.createElement("a");
var download = chart.options.download;
Function renderColumnChart
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
defaultExport$1.prototype.renderColumnChart = function renderColumnChart (chart, chartType) {
chartType = chartType || "column";
var series = chart.data;
var options = jsOptions$1(chart, chart.options), i, j, s, d, rows = [], categories = [];
options.chart.type = chartType;
Function jsOptionsFunc
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function jsOptionsFunc(defaultOptions, hideLegend, setTitle, setMin, setMax, setStacked, setXtitle, setYtitle) {
return function (chart, opts, chartOptions) {
var series = chart.data;
var options = merge({}, defaultOptions);
options = merge(options, chartOptions || {});
Function renderPieChart
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
defaultExport.prototype.renderPieChart = function renderPieChart (chart) {
var options = merge({}, baseOptions);
if (chart.options.donut) {
options.cutoutPercentage = 50;
}
Function parseISO8601
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseISO8601(input) {
var day, hour, matches, milliseconds, minutes, month, offset, result, seconds, type, year;
type = Object.prototype.toString.call(input);
if (type === "[object Date]") {
return input;
Function renderPieChart
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
defaultExport$2.prototype.renderPieChart = function renderPieChart (chart) {
var this$1 = this;
this.waitForLoaded(chart, function () {
var chartOptions = {
Function jsOptionsFunc
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function jsOptionsFunc(defaultOptions, hideLegend, setTitle, setMin, setMax, setStacked, setXtitle, setYtitle) {
Consider simplifying this complex logical expression. Open
Open
if (chart.xtype === "datetime") {
value = new Date(toFloat(i));
// TODO make this efficient
day = day && isDay(value);
if (!dayOfWeek) {
Avoid deeply nested control flow statements. Open
Open
if (label) {
label += ': ';
}
Avoid deeply nested control flow statements. Open
Open
if (isArray(dataLabel)) {
// show value on first line of multiline label
// need to clone because we are changing the value
dataLabel = dataLabel.slice();
dataLabel[0] += value;
Consider simplifying this complex logical expression. Open
Open
if ((options.xmin || options.xmax) && (!options.xmin || isDate(options.xmin)) && (!options.xmax || isDate(options.xmax))) {
return "datetime";
} else {
return "number";
}
Avoid too many return
statements within this function. Open
Open
return "string";