Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions dist/wxcharts-min.js

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions dist/wxcharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,6 @@ function getSeriesDataItem(series, index) {
return data;
}



function getMaxTextListLength(list) {
var lengthList = list.map(function (item) {
return measureText(item);
Expand Down Expand Up @@ -849,6 +847,7 @@ function drawRadarLabel(angleList, radius, centerPosition, opts, config, context

function drawPieText(series, opts, config, context, radius, center) {
var lineRadius = radius + config.pieChartLinePadding;
var textRadius = lineRadius + config.pieChartTextPadding;
var textObjectCollection = [];
var lastTextObject = null;

Expand Down Expand Up @@ -1057,6 +1056,8 @@ function drawColumnDataPoints(series, opts, config, context) {

var minRange = ranges.pop();
var maxRange = ranges.shift();
var endY = opts.height - config.padding - config.xAxisHeight - config.legendHeight;

context.save();
if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
context.translate(opts._scrollDistance_, 0);
Expand Down Expand Up @@ -1286,8 +1287,6 @@ function drawToolTipBridge(opts, config, context, process) {
function drawXAxis(categories, opts, config, context) {
var _getXAxisPoints4 = getXAxisPoints(categories, opts, config),
xAxisPoints = _getXAxisPoints4.xAxisPoints,
startX = _getXAxisPoints4.startX,
endX = _getXAxisPoints4.endX,
eachSpacing = _getXAxisPoints4.eachSpacing;

var startY = opts.height - config.padding - config.xAxisHeight - config.legendHeight;
Expand Down Expand Up @@ -1401,6 +1400,7 @@ function drawYAxis(series, opts, config, context) {
var eachSpacing = Math.floor(spacingValid / config.yAxisSplit);
var startX = config.padding + yAxisTotalWidth;
var endX = opts.width - config.padding;
var startY = config.padding;
var endY = opts.height - config.padding - config.xAxisHeight - config.legendHeight;

// set YAxis background
Expand Down Expand Up @@ -1441,7 +1441,8 @@ function drawLegend(series, opts, config, context) {
// legend margin top `config.padding`

var _calLegendData = calLegendData(series, opts, config),
legendList = _calLegendData.legendList;
legendList = _calLegendData.legendList,
legendHeight = _calLegendData.legendHeight;

var padding = 5;
var marginTop = 8;
Expand Down Expand Up @@ -1918,13 +1919,13 @@ var Charts = function Charts(opts) {
opts.extra = opts.extra || {};
opts.legend = opts.legend === false ? false : true;
opts.animation = opts.animation === false ? false : true;
var config$$1 = assign({}, config);
config$$1.yAxisTitleWidth = opts.yAxis.disabled !== true && opts.yAxis.title ? config$$1.yAxisTitleWidth : 0;
config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : config$$1.pieChartLinePadding;
config$$1.pieChartTextPadding = opts.dataLabel === false ? 0 : config$$1.pieChartTextPadding;
var config$1 = assign({}, config);
config$1.yAxisTitleWidth = opts.yAxis.disabled !== true && opts.yAxis.title ? config$1.yAxisTitleWidth : 0;
config$1.pieChartLinePadding = opts.dataLabel === false ? 0 : config$1.pieChartLinePadding;
config$1.pieChartTextPadding = opts.dataLabel === false ? 0 : config$1.pieChartTextPadding;

this.opts = opts;
this.config = config$$1;
this.config = config$1;
this.context = wx.createCanvasContext(opts.canvasId);
// store calcuated chart data
// such as chart point coordinate
Expand All @@ -1936,7 +1937,7 @@ var Charts = function Charts(opts) {
distance: 0
};

drawCharts.call(this, opts.type, opts, config$$1, this.context);
drawCharts.call(this, opts.type, opts, config$1, this.context);
};

Charts.prototype.updateData = function () {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"babel-plugin-external-helpers": "^6.18.0",
"babel-preset-es2015": "^6.18.0",
"rollup-plugin-babel": "^2.6.1",
"rollup-plugin-uglify": "^1.0.1"
"rollup-plugin-uglify": "^6.0.4"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand Down
20 changes: 11 additions & 9 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ let banner = `/*
`;

export default {
entry: 'src/app.js',
format: 'cjs',
dest: 'dist/wxcharts.js',
plugins: [
babel({
exclude: 'node_modules/**',
})
],
banner: banner
input: 'src/app.js',
output: {
file: 'dist/wxcharts.js',
format: 'cjs',
banner: banner,
},
plugins: [
babel({
exclude: 'node_modules/**',
})
],
};
24 changes: 13 additions & 11 deletions rollup.config.prod.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import babel from 'rollup-plugin-babel';
import uglify from 'rollup-plugin-uglify';
import { uglify } from 'rollup-plugin-uglify';

let banner = `/*
* charts for WeChat small app v1.0
Expand All @@ -12,14 +12,16 @@ let banner = `/*
`;

export default {
entry: 'src/app.js',
format: 'cjs',
dest: 'dist/wxcharts-min.js',
plugins: [
babel({
exclude: 'node_modules/**',
}),
uglify()
],
banner: banner
input: 'src/app.js',
output: {
file: 'dist/wxcharts-min.js',
format: 'cjs',
banner: banner,
},
plugins: [
babel({
exclude: 'node_modules/**',
}),
uglify()
],
};