Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1284)

Unified Diff: polymer_0.5.0/bower_components/chartnewjs/previous_versions/ChartNew_V1.js

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: polymer_0.5.0/bower_components/chartnewjs/previous_versions/ChartNew_V1.js
diff --git a/bower_components/chartnewjs/ChartNew.js b/polymer_0.5.0/bower_components/chartnewjs/previous_versions/ChartNew_V1.js
similarity index 99%
rename from bower_components/chartnewjs/ChartNew.js
rename to polymer_0.5.0/bower_components/chartnewjs/previous_versions/ChartNew_V1.js
index 6c756e6e647a101f9c0dc5e811a893ab9bb795c0..c44c632bfa24114fb39ce06d9f2b4d246b7ab951 100644
--- a/bower_components/chartnewjs/ChartNew.js
+++ b/polymer_0.5.0/bower_components/chartnewjs/previous_versions/ChartNew_V1.js
@@ -637,6 +637,8 @@ var dynamicDisplayList = new Array();
function dynamicFunction(data, config, ctx) {
+ if (isIE() < 9 && isIE() != false) return(true);
+
if (config.dynamicDisplay) {
if (ctx.canvas.id == "") {
var cvdate = new Date();
@@ -3332,7 +3334,7 @@ window.Chart = function(context) {
for (var j = 0; j < data.datasets[i].data.length; j++) {
var currentAnimPc = animationCorrection(animPc, data, config, i, j, 1).animVal;
if (currentAnimPc > 1) currentAnimPc = currentAnimPc - 1;
- if (i == 0) {
+ if (typeof tempp[j]=="undefined") {
tempp[j]=0;
tempn[j]=0;
zeroY= calculateOffset(config.logarithmic, 0 , calculatedScale, scaleHop);
@@ -3365,7 +3367,7 @@ window.Chart = function(context) {
}
}
ctx.strokeStyle = config.defaultStrokeColor;
- if (typeof data.datasets[i].strokeColor == "function") ctx.strokeStyle = data.datasets[i].strokeColor("STROKECOLOR", data, config, i, j, currentAnimPc, 1 * data.datasets[i].data[j], "StackedBar", ctx, barOffset, botBar, barOffset + barwidth, topBar);
+ if (typeof data.datasets[i].strokeColor == "function") ctx.strokeStyle = data.datasets[i].strokeColor("STROKECOLOR", data, config, i, j, currentAnimPc, 1 * data.datasets[i].data[j], "StackedBar", ctx, barOffset, botBar, barOffset + barWidth, topBar);
else if (typeof(data.datasets[i].strokeColor) == "string") {
ctx.strokeStyle = data.datasets[i].strokeColor;
} else if (typeof(data.datasets[i].strokeColor) == "object") {
@@ -3403,6 +3405,10 @@ window.Chart = function(context) {
}
}
}
+
+ var tempp = new Array(data.datasets.length);
+ var tempn = new Array(data.datasets.length);
+
if (animPc >= 1 && config.inGraphDataShow) {
var yPos = 0,
xPos = 0;
@@ -3415,7 +3421,7 @@ window.Chart = function(context) {
if (typeof(data.datasets[i].title) == "string") lgtxt = data.datasets[i].title.trim();
else lgtxt = "";
for (var j = 0; j < data.datasets[i].data.length; j++) {
- if (i == 0) {
+ if (typeof tempp[j]=="undefined") {
tempp[j]=0;
tempn[j]=0;
zeroY= calculateOffset(config.logarithmic, 0 , calculatedScale, scaleHop);
@@ -3469,7 +3475,7 @@ window.Chart = function(context) {
if (config.inGraphDataYPosition == 1) {
yPos = botBar - config.inGraphDataPaddingY;
} else if (config.inGraphDataYPosition == 2) {
- yPos = topBar - (botbar-topbar)/2 - config.inGraphDataPaddingY;
+ yPos = topBar + (botBar-topBar)/2 - config.inGraphDataPaddingY;
} else if (config.inGraphDataYPosition == 3) {
yPos = topBar - config.inGraphDataPaddingY;
}
@@ -3552,11 +3558,11 @@ window.Chart = function(context) {
for (var i = 0; i < data.labels.length; i++) {
ctx.save();
if (msr.rotateLabels > 0) {
- ctx.translate(yAxisPosX + i * valueHop + (barWidth / 2) - msr.highestXLabel / 2, msr.xLabelPos);
+ ctx.translate(yAxisPosX + config.barValueSpacing + i * valueHop + (barWidth / 2) - msr.highestXLabel / 2, msr.xLabelPos);
ctx.rotate(-(msr.rotateLabels * (Math.PI / 180)));
ctx.fillTextMultiLine(fmtChartJS(config, data.labels[i], config.fmtXLabel), 0, 0, ctx.textBaseline, config.scaleFontSize);
} else {
- ctx.fillTextMultiLine(fmtChartJS(config, data.labels[i], config.fmtXLabel), yAxisPosX + i * valueHop + (barWidth / 2), msr.xLabelPos, ctx.textBaseline, config.scaleFontSize);
+ ctx.fillTextMultiLine(fmtChartJS(config, data.labels[i], config.fmtXLabel), yAxisPosX + config.barValueSpacing + i * valueHop + (barWidth / 2), msr.xLabelPos, ctx.textBaseline, config.scaleFontSize);
}
ctx.restore();
}
@@ -3775,7 +3781,7 @@ window.Chart = function(context) {
for (var j = 0; j < data.datasets[i].data.length; j++) {
var currentAnimPc = animationCorrection(animPc, data, config, i, j, 1).animVal;
if (currentAnimPc > 1) currentAnimPc = currentAnimPc - 1;
- if (i == 0) {
+ if (typeof tempp[j] == "undefined") {
tempp[j]=0;
tempn[j]=0;
zeroY= HorizontalCalculateOffset(0 , calculatedScale, scaleHop);
@@ -3846,6 +3852,10 @@ window.Chart = function(context) {
}
}
if (animPc >= 1 && config.inGraphDataShow) {
+
+ var tempp = new Array(data.datasets.length);
+ var tempn = new Array(data.datasets.length);
+
var yPos = 0,
xPos = 0;
for (var i = 0; i < data.datasets.length; i++) {
@@ -3857,7 +3867,7 @@ window.Chart = function(context) {
if (typeof(data.datasets[i].title) == "string") lgtxt = data.datasets[i].title.trim();
else lgtxt = "";
for (var j = 0; j < data.datasets[i].data.length; j++) {
- if (i == 0) {
+ if (typeof tempp[j] == "undefined") {
tempp[j]=0;
tempn[j]=0;
zeroY= HorizontalCalculateOffset(0 , calculatedScale, scaleHop);
@@ -5560,12 +5570,12 @@ window.Chart = function(context) {
availableWidth = width - leftNotUsableSize - rightNotUsableSize;
// Title
if (config.graphTitle.trim() != "") {
- graphTitleHeight = (config.graphTitleFontSize + config.graphTitleSpaceBefore + config.graphTitleSpaceAfter);
+ graphTitleHeight = (config.graphTitleFontSize * (config.graphTitle.split("\n").length || 1) + config.graphTitleSpaceBefore + config.graphTitleSpaceAfter);
graphTitlePosY = borderWidth + config.spaceTop + graphTitleHeight - config.graphTitleSpaceAfter;
}
// subTitle
if (config.graphSubTitle.trim() != "") {
- graphSubTitleHeight = (config.graphSubTitleFontSize + config.graphSubTitleSpaceBefore + config.graphSubTitleSpaceAfter);
+ graphSubTitleHeight = (config.graphSubTitleFontSize * (config.graphSubTitle.split("\n").length || 1) + config.graphSubTitleSpaceBefore + config.graphSubTitleSpaceAfter);
graphSubTitlePosY = borderWidth + config.spaceTop + graphTitleHeight + graphSubTitleHeight - config.graphSubTitleSpaceAfter;
}
// yAxisUnit
@@ -5851,7 +5861,7 @@ window.Chart = function(context) {
ctx.textAlign = "center";
ctx.textBaseline = "bottom";
ctx.translate(config.spaceLeft + (width - config.spaceLeft - config.spaceRight) / 2, graphTitlePosY);
- ctx.fillText(config.graphTitle, 0, 0);
+ ctx.fillTextMultiLine(config.graphTitle, 0, 0, ctx.textBaseline, config.graphTitleFontSize);
ctx.stroke();
ctx.restore();
}
@@ -5864,7 +5874,7 @@ window.Chart = function(context) {
ctx.textAlign = "center";
ctx.textBaseline = "bottom";
ctx.translate(config.spaceLeft + (width - config.spaceLeft - config.spaceRight) / 2, graphSubTitlePosY);
- ctx.fillText(config.graphSubTitle, 0, 0);
+ ctx.fillTextMultiLine(config.graphSubTitle, 0, 0, ctx.textBaseline, config.graphSubTitleFontSize);
ctx.stroke();
ctx.restore();
}
@@ -5948,7 +5958,7 @@ window.Chart = function(context) {
yLegendBorderPos : yLegendBorderPos, legendBorderWidth : legendBorderWidth, legendBorderHeight : legendBorderHeight,
nbLegendCols: nbLegendCols, xFirstLegendTextPos : xFirstLegendTextPos , yFirstLegendTextPos : yFirstLegendTextPos,
drawLegendOnData : drawLegendOnData, reverseLegend : reverseLegend, legendBox : legendBox, widestLegend : widestLegend };
- if(config.legendPosY==0 || config.legendPosY==4) {
+ if(config.legendPosY==0 || config.legendPosY==4 || config.legendPosX==0 || config.legendPosX==4) {
drawLegend(legendMsr,data,config,ctx,typegraph);
var legendMsr={dispLegend : false};
}
« no previous file with comments | « polymer_0.5.0/bower_components/chartnewjs/mathFunctions.js ('k') | polymer_0.5.0/bower_components/chartnewjs/sample.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698