Aspect Ratio Functionality Version Pre-Alpha Ready

This commit is contained in:
Luis Fernando Molina committed 2018-06-28 16:43:52 +02:00
1 parent be93031e1c
commit 6a5c9e60c8
3 files changed
+43 -6

No files matched your search

+3
View File
@@ -72,6 +72,9 @@
thisObject.aspectRatio.y = MAX_Y_ASPECT_RATIO;
}
thisObject.container.eventHandler.raiseEvent("Chart Aspect Ratio Changed", thisObject.aspectRatio);
}
function getContainer(point) {
+2 -2
View File
@@ -552,7 +552,7 @@
let fontSize = 10;
let label = ' ' + Math.round(j * 1000000) / 1000000;
let label = ' ' + Math.round(j * 1) / 1;
label = Number(label).toLocaleString();
let labelPoint = {
@@ -586,7 +586,7 @@
*/
let labelValue = (j - timeLineCoordinateSystem.max.y / 2) * 200 / timeLineCoordinateSystem.max.y;
labelValue = Math.round(labelValue * 1000000) / 1000000;
labelValue = Math.round(labelValue * 1) / 1;
if (labelValue > 0) { labelValue = '+' + labelValue; }
if (parseInt(labelValue) > -10 && parseInt(labelValue) < 10) { labelValue = ' ' + labelValue; }
if (parseInt(labelValue) === 0) { labelValue = ' ' + labelValue; }
+38 -4
View File
@@ -129,6 +129,44 @@
initializeCompetitionPlotters(onCompetitionPlottersInitialized);
canvas.bottomSpace.chartAspectRatio.container.eventHandler.listenToEvent("Chart Aspect Ratio Changed", onAspectRatioChanged);
function onAspectRatioChanged(pAspectRatio) {
thisObject.container.frame.height = CHART_SPACE_HEIGHT * pAspectRatio.y;
recalculateScale();
/* First the Product Plotters. */
for (let i = 0; i < productPlotters.length; i++) {
let productPlotter = productPlotters[i];
productPlotter.plotter.container.frame.width = thisObject.container.frame.width;
productPlotter.plotter.container.frame.height = thisObject.container.frame.height;
if (productPlotter.plotter.recalculateScale !== undefined) {
productPlotter.plotter.recalculateScale();
}
}
/* Then the competition plotters. */
for (let i = 0; i < competitionPlotters.length; i++) {
let competitionPlotter = competitionPlotters[i];
competitionPlotter.plotter.container.frame.width = thisObject.container.frame.width;
competitionPlotter.plotter.container.frame.height = thisObject.container.frame.height;
if (competitionPlotter.plotter.recalculateScale !== undefined) {
competitionPlotter.plotter.recalculateScale();
}
}
}
function onCompetitionPlottersInitialized(err) {
try {
@@ -904,7 +942,6 @@
y: nextPorwerOf10(USDT_BTC_HTH) / 4
};
timeLineCoordinateSystem.initialize(
minValue,
maxValue,
@@ -946,9 +983,6 @@
if (thisObject.container.frame.isInViewPort()) {
thisObject.container.frame.height = CHART_SPACE_HEIGHT * canvas.bottomSpace.chartAspectRatio.aspectRatio.y;
recalculateScale();
this.container.frame.draw();
drawBackground();