Notice: Undefined index: year in /home/fantasyhockeypla/public_html/js/dataGoalie.php on line 9
var playerData = generatePlayerData(); var annualPlayerData = generateAnnualPlayerData(); var totalPlayerData = generateTotalPlayerData(); var chartSeasonProgression = AmCharts.makeChart("chartSeasonProgression", { "type": "serial", "theme": "light", "legend": { "useGraphSettings": true }, "dataProvider": playerData, "synchronizeGrid":true, "valueAxes": [{ "id":"v1", "axisColor": "#008800", "axisThickness": 2, "axisAlpha": 1, "position": "left" }, { "id":"v1", "axisColor": "#008800", "axisThickness": 2, "axisAlpha": 1, "position": "right" }], "graphs": [{ "id": "graphEffLastYear", "valueAxis": "v2", "lineColor": "#0000FF", "balloonText": "[[title]]
[[value]]% Eff", "bullet": "square", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Last year % Eff", "valueField": "EffLastYear", "fillAlphas": 0 },{ "id": "graphEffGoalieAverage", "valueAxis": "v3", "lineColor": "#000000", "balloonText": "[[title]]
[[value]]% Eff", "bullet": "triangleUp", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Goalie % Eff average", "valueField": "EffGoalieAverage", "fillAlphas": 0 },{ "id": "graphEffThisYear", "valueAxis": "v1", "lineColor": "#008800", "balloonText": "[[title]]
[[value]]% Eff", "bullet": "round", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "This year % Eff", "valueField": "EffThisYear", "fillAlphas": 0 }], "chartScrollbar": { "graph":"graphTotalLastYear", "gridAlpha":0, "color":"#888888", "scrollbarHeight":55, "backgroundAlpha":0, "selectedBackgroundAlpha":0.1, "selectedBackgroundColor":"#888888", "graphFillAlpha":0, "autoGridCount":true, "selectedGraphFillAlpha":0, "graphLineAlpha":0.2, "graphLineColor":"#0000FF", "selectedGraphLineColor":"#0000FF", "selectedGraphLineAlpha":1 }, "chartCursor": { "cursorPosition": "mouse" }, "categoryField": "date", "categoryAxis": { "parseDates": true, "axisColor": "#DADADA", "minorGridEnabled": true }, "export": { "enabled": false, "position": "bottom-right" } }); chartSeasonProgression.addListener("dataUpdated", zoomChartSeasonProgression); var chartSeasonProgressionVictories = AmCharts.makeChart("chartSeasonProgressionVictories", { "type": "serial", "theme": "light", "legend": { "useGraphSettings": true }, "dataProvider": playerData, "synchronizeGrid":true, "valueAxes": [{ "id":"v1", "axisColor": "#008800", "axisThickness": 2, "axisAlpha": 1, "position": "left" }, { "id":"v1", "axisColor": "#008800", "axisThickness": 2, "axisAlpha": 1, "position": "right" }], "graphs": [{ "id": "graphPointsLastYear", "valueAxis": "v2", "lineColor": "#0000FF", "balloonText": "[[title]]
[[value]] pts", "bullet": "square", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Points last year", "valueField": "pointsLastYear", "fillAlphas": 0 }, { "id": "graphPointsAverage", "valueAxis": "v3", "lineColor": "#000000", "balloonText": "[[title]]
[[value]] pts", "bullet": "triangleUp", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Points average", "valueField": "pointsAverage", "fillAlphas": 0 }, { "id": "graphPointsThisYear", "valueAxis": "v1", "lineColor": "#008800", "balloonText": "[[title]]
[[value]] pts", "bullet": "round", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Points this year", "valueField": "pointsThisYear", "fillAlphas": 0 }], "chartScrollbar": { "graph":"graphTotalLastYear", "gridAlpha":0, "color":"#888888", "scrollbarHeight":55, "backgroundAlpha":0, "selectedBackgroundAlpha":0.1, "selectedBackgroundColor":"#888888", "graphFillAlpha":0, "autoGridCount":true, "selectedGraphFillAlpha":0, "graphLineAlpha":0.2, "graphLineColor":"#0000FF", "selectedGraphLineColor":"#0000FF", "selectedGraphLineAlpha":1 }, "chartCursor": { "cursorPosition": "mouse" }, "categoryField": "date", "categoryAxis": { "parseDates": true, "axisColor": "#DADADA", "minorGridEnabled": true }, "export": { "enabled": false, "position": "bottom-right" } }); chartSeasonProgressionVictories.addListener("dataUpdated", zoomChartSeasonProgressionVictories); var chartPointsPerGame = AmCharts.makeChart("chartPointsPerGame", { "type": "serial", "theme": "light", "legend": { "useGraphSettings": true }, "dataProvider": playerData, "synchronizeGrid":true, "valueAxes": [{ "id":"v1", "axisColor": "#008800", "axisThickness": 2, "axisAlpha": 1, "position": "left" }, { "id":"v1", "axisColor": "#008800", "axisThickness": 2, "axisAlpha": 1, "position": "right" }], "graphs": [{ "id": "graphLastYear", "valueAxis": "v2", "lineColor": "#0000FF", "balloonText": "[[title]]
[[value]] %Eff", "bullet": "square", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Last year", "valueField": "EffLastYear", "fillAlphas": 0 }, { "id": "graphPlayerAverage", "valueAxis": "v3", "lineColor": "#000000", "balloonText": "[[title]]
[[value]] %Eff", "bullet": "triangleUp", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Goalie average", "valueField": "EffGoalieAverage", "fillAlphas": 0 }, { "id": "graphThisYear", "valueAxis": "v1", "lineColor": "#008800", "balloonText": "[[title]]
[[value]] %Eff", "bullet": "round", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "This year", "valueField": "EffThisYear", "fillAlphas": 0 }], "chartScrollbar": { "graph":"graphLastYear", "gridAlpha":0, "color":"#888888", "scrollbarHeight":55, "backgroundAlpha":0, "selectedBackgroundAlpha":0.1, "selectedBackgroundColor":"#888888", "graphFillAlpha":0, "autoGridCount":true, "selectedGraphFillAlpha":0, "graphLineAlpha":0.2, "graphLineColor":"#0000FF", "selectedGraphLineColor":"#0000FF", "selectedGraphLineAlpha":1 }, "chartCursor": { "cursorPosition": "mouse" }, "categoryField": "date", "categoryAxis": { "parseDates": true, "axisColor": "#DADADA", "minorGridEnabled": true }, "export": { "enabled": false, "position": "bottom-right" } }); chartPointsPerGame.addListener("dataUpdated", zoomChartPointsPerGame); var chartYearlyProgression = AmCharts.makeChart("chartYearlyProgression", { "type": "serial", "theme": "light", "legend": { "useGraphSettings": true }, "dataProvider": annualPlayerData, "synchronizeGrid":true, "valueAxes": [{ "id":"v1", "axisColor": "#008800", "axisThickness": 2, "axisAlpha": 1, "position": "left" }, { "id":"v1", "axisColor": "#008800", "axisThickness": 2, "axisAlpha": 1, "position": "right" }], "graphs": [{ "id": "graphPoints", "valueAxis": "v1", "lineColor": "#000000", "balloonText": "[[category]]
[[value]] % Eff", "bullet": "round", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "% Efficiency", "valueField": "Eff", "fillAlphas": 0 }], "chartScrollbar": { "graph":"graphPoints", "gridAlpha":0, "color":"#888888", "scrollbarHeight":55, "backgroundAlpha":0, "selectedBackgroundAlpha":0.1, "selectedBackgroundColor":"#888888", "graphFillAlpha":0, "autoGridCount":true, "selectedGraphFillAlpha":0, "graphLineAlpha":0.2, "graphLineColor":"#0000FF", "selectedGraphLineColor":"#0000FF", "selectedGraphLineAlpha":1 }, "chartCursor": { "cursorPosition": "mouse" }, "categoryField": "year", "categoryAxis": { "parseDates": false, "axisColor": "#DADADA", "minorGridEnabled": true }, "export": { "enabled": false, "position": "bottom-right" } }); chartYearlyProgression.addListener("dataUpdated", zoomChartYearlyProgression); var chartYearlyProgressionVictories = AmCharts.makeChart("chartYearlyProgressionVictories", { "type": "serial", "theme": "light", "legend": { "useGraphSettings": true }, "dataProvider": annualPlayerData, "synchronizeGrid":true, "valueAxes": [{ "id":"v1", "axisColor": "#008800", "axisThickness": 2, "axisAlpha": 1, "position": "left" }, { "id":"v1", "axisColor": "#008800", "axisThickness": 2, "axisAlpha": 1, "position": "right" }], "graphs": [{ "id": "graphGames", "valueAxis": "v1", "lineColor": "#0000FF", "balloonText": "[[category]]
[[value]] games", "bullet": "square", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Games", "valueField": "games", "fillAlphas": 0 },{ "id": "graphPoints", "valueAxis": "v1", "lineColor": "#000000", "balloonText": "[[category]]
[[value]] pts", "bullet": "round", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Points", "valueField": "points", "fillAlphas": 0 }], "chartScrollbar": { "graph":"graphPoints", "gridAlpha":0, "color":"#888888", "scrollbarHeight":55, "backgroundAlpha":0, "selectedBackgroundAlpha":0.1, "selectedBackgroundColor":"#888888", "graphFillAlpha":0, "autoGridCount":true, "selectedGraphFillAlpha":0, "graphLineAlpha":0.2, "graphLineColor":"#0000FF", "selectedGraphLineColor":"#0000FF", "selectedGraphLineAlpha":1 }, "chartCursor": { "cursorPosition": "mouse" }, "categoryField": "year", "categoryAxis": { "parseDates": false, "axisColor": "#DADADA", "minorGridEnabled": true }, "export": { "enabled": false, "position": "bottom-right" } }); chartYearlyProgressionVictories.addListener("dataUpdated", zoomChartYearlyProgressionVictories); var chartTotalEfficiencyProgression = AmCharts.makeChart("chartTotalEfficiencyProgression", { "type": "serial", "theme": "light", "legend": { "useGraphSettings": true }, "dataProvider": totalPlayerData, "synchronizeGrid":true, "valueAxes": [{ "id":"v1", "axisColor": "#008800", "axisThickness": 2, "axisAlpha": 1, "position": "left" }, { "id":"v1", "axisColor": "#008800", "axisThickness": 2, "axisAlpha": 1, "position": "right" }], "graphs": [{ "id": "graphEff", "valueAxis": "v1", "lineColor": "#000000", "balloonText": "[[category]]
[[value]] %Eff", "bullet": "round", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "% Efficiency", "valueField": "Eff", "fillAlphas": 0 }, { "id": "graphAvgEff", "valueAxis": "v1", "lineColor": "#0000FF", "balloonText": "[[category]]
[[value]] Avg %Eff", "bullet": "round", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Average % Efficiency", "valueField": "averageEff", "fillAlphas": 0 }], "chartScrollbar": { "graph":"graphEff", "gridAlpha":0, "color":"#888888", "scrollbarHeight":55, "backgroundAlpha":0, "selectedBackgroundAlpha":0.1, "selectedBackgroundColor":"#888888", "graphFillAlpha":0, "autoGridCount":true, "selectedGraphFillAlpha":0, "graphLineAlpha":0.2, "graphLineColor":"#0000FF", "selectedGraphLineColor":"#0000FF", "selectedGraphLineAlpha":1 }, "chartCursor": { "cursorPosition": "mouse" }, "categoryField": "date", "categoryAxis": { "parseDates": true, "axisColor": "#DADADA", "minorGridEnabled": true, "equalSpacing": true }, "export": { "enabled": false, "position": "bottom-right" } }); chartTotalEfficiencyProgression.addListener("dataUpdated", zoomChartTotalEfficiencyProgression); var chartTotalProduction = AmCharts.makeChart("chartTotalProduction", { "type": "serial", "theme": "light", "legend": { "useGraphSettings": true }, "dataProvider": totalPlayerData, "synchronizeGrid":true, "valueAxes": [{ "id":"v1", "axisColor": "#008800", "axisThickness": 2, "axisAlpha": 1, "position": "left" }, { "id":"v1", "axisColor": "#008800", "axisThickness": 2, "axisAlpha": 1, "position": "right" }], "graphs": [{ "id": "graphTotalWins", "valueAxis": "v2", "lineColor": "#008800", "balloonText": "[[category]]
[[value]] wins", "bullet": "square", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Wins", "valueField": "wins", "fillAlphas": 0 }, { "id": "graphTotalOTLosses", "valueAxis": "v3", "lineColor": "#0000FF", "balloonText": "[[category]]
[[value]] OT losses", "bullet": "triangleUp", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "OT Losses", "valueField": "otLosses", "fillAlphas": 0 }, { "id": "graphTotalShutouts", "valueAxis": "v4", "lineColor": "#CC0000", "balloonText": "[[category]]
[[value]] shutouts", "bullet": "triangleDown", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Shutouts", "valueField": "shutouts", "fillAlphas": 0 }, { "id": "graphTotalPoints", "valueAxis": "v1", "lineColor": "#000000", "balloonText": "[[category]]
[[value]] pts", "bullet": "round", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Points", "valueField": "points", "fillAlphas": 0 }, { "id": "graphTotalCurrentTrend", "valueAxis": "v1", "lineColor": "#AAAAAA", "balloonText": "[[title]]
[[value]] pts", "bullet": "round", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Current trend", "valueField": "currentTrend", "fillAlphas": 0 }, { "id": "graphTotalAverageTrend", "valueAxis": "v1", "lineColor": "#FFA500", "balloonText": "[[title]]
[[value]] pts", "bullet": "round", "bulletBorderThickness": 1, "hideBulletsCount": 30, "title": "Average trend", "valueField": "averageTrend", "fillAlphas": 0 }], "chartScrollbar": { "graph":"graphTotalPoints", "gridAlpha":0, "color":"#888888", "scrollbarHeight":55, "backgroundAlpha":0, "selectedBackgroundAlpha":0.1, "selectedBackgroundColor":"#888888", "graphFillAlpha":0, "autoGridCount":true, "selectedGraphFillAlpha":0, "graphLineAlpha":0.2, "graphLineColor":"#0000FF", "selectedGraphLineColor":"#0000FF", "selectedGraphLineAlpha":1 }, "chartCursor": { "cursorPosition": "mouse" }, "categoryField": "date", "categoryAxis": { "parseDates": true, "axisColor": "#DADADA", "minorGridEnabled": true, "equalSpacing": true }, "export": { "enabled": false, "position": "bottom-right" } }); chartTotalProduction.addListener("dataUpdated", zoomChartTotalProduction); zoomChartSeasonProgression(); zoomChartSeasonProgressionVictories(); zoomChartPointsPerGame(); zoomChartYearlyProgression(); zoomChartYearlyProgressionVictories(); zoomChartTotalEfficiencyProgression(); zoomChartTotalProduction(); function generatePlayerData() { var playerData = []; // If we're before August, use last year's first game var firstDate = new Date(0, 9, 1, 0, 0, 0, 0); var thisYear = 0; var lastYear = 0; var playerAverage = 0; var winsThisYear = 0; var winsLastYear = 0; var winsAverage = 0; var shutoutsThisYear = 0; var shutoutsLastYear = 0; var shutoutsAverage = 0; var otLossesThisYear = 0; var otLossesLastYear = 0; var otLossesAverage = 0; var pointsThisYear = 0; var pointsLastYear = 0; var pointsAverage = 0; var GAAThisYear = 0; var GAALastYear = 0; var GAAGoalieAverage = 0; var EffThisYear = 0; var EffLastYear = 0; var EffGoalieAverage = 0; var firstGameOfYear = new Date(0, 9, 1, 0, 0, 0, 0); var lastGameOfYear = new Date(1, 4, 30, 0, 0, 0, 0); var nbOfDays = datediff(firstGameOfYear, lastGameOfYear); var averageNumberOfGamesAGoaliePlays = 60; return playerData; } function generateAnnualPlayerData() { var annualPlayerData = []; var games = 0; var wins = 0; var shutouts = 0; var otLosses = 0; var points = 0; var GAA = 0; var Eff = 0; var newYear = 0; return annualPlayerData; } function generateTotalPlayerData() { var totalPlayerData = []; var wins = 0; var shutouts = 0; var otLosses = 0; var points = 0; var Eff = 0; var averageEff = 0; var gameNumber = 0; var gameDate = ''; var currentAveragePointsPerGame = totalPlayerData[totalPlayerData.length-1].points / (totalPlayerData.length - 1); var averagePointsPerGame = totalPlayerData[parseInt((totalPlayerData.length-1)/2)].points / parseInt((totalPlayerData.length-1)/2); var currentTrend = 0; var averageTrend = 0; for(var i = 0; i < totalPlayerData.length; i++) { totalPlayerData[i].currentTrend = currentTrend.toFixed(2); totalPlayerData[i].averageTrend = averageTrend.toFixed(2); currentTrend += currentAveragePointsPerGame; averageTrend += averagePointsPerGame; } return totalPlayerData; } function zoomChartSeasonProgression(){ /* By default, show up to today */ var nbGamesMinimum = 15; var firstGameOfYear = new Date(0, 9, 1, 0, 0, 0, 0); var firstFifteenGames = new Date(0, 9, 15, 0, 0, 0, 0); var today = new Date(); var lastIndex = datediff(firstGameOfYear, today) - 1; /* If today before the 15 first games, show the 15 first games */ if (today < firstFifteenGames) { lastIndex = nbGamesMinimum - 1; } /* If today is after the last game of the year, we use the last game */ if (lastIndex > chartSeasonProgression.dataProvider.length - 1) { lastIndex = chartSeasonProgression.dataProvider.length - 1; } chartSeasonProgression.zoomToIndexes(0, lastIndex); } function zoomChartSeasonProgressionVictories(){ /* By default, show up to today */ var nbGamesMinimum = 15; var firstGameOfYear = new Date(0, 9, 1, 0, 0, 0, 0); var firstFifteenGames = new Date(0, 9, 15, 0, 0, 0, 0); var today = new Date(); var lastIndex = datediff(firstGameOfYear, today) - 1; /* If today before the 15 first games, show the 15 first games */ if (today < firstFifteenGames) { lastIndex = nbGamesMinimum - 1; } /* If today is after the last game of the year, we use the last game */ if (lastIndex > chartSeasonProgressionVictories.dataProvider.length - 1) { lastIndex = chartSeasonProgressionVictories.dataProvider.length - 1; } chartSeasonProgressionVictories.zoomToIndexes(0, lastIndex); } function zoomChartPointsPerGame(){ /* By default, show last 25 days */ var nbGames = 25; var firstGameOfYear = new Date(0, 9, 1, 0, 0, 0, 0); var lastGameOfYear = new Date(1, 4, 30, 0, 0, 0, 0); var today = new Date(); var xNbGamesAgo = new Date(); var thisYear = new Date(); thisYear = thisYear.getFullYear(); // If we're in July or before, we check last year instead... if (today.getMonth() <= 6) { thisYear -= 1; } //If the year we're looking at isn't this year... if (0 != thisYear) { today = lastGameOfYear; xNbGamesAgo = lastGameOfYear; } xNbGamesAgo.setDate(xNbGamesAgo.getDate() - nbGames); var firstIndex = 0; var lastIndex = nbGames - 1; /* If 25 games ago it's before the first game of the year, we start at the first game */ if (xNbGamesAgo < firstGameOfYear) { firstIndex = 0; } else { firstIndex = datediff(firstGameOfYear, xNbGamesAgo) - 1; } lastIndex = firstIndex + nbGames; /* If 25 days after 25 days ago is later than the last game of the year */ if (lastIndex > chartPointsPerGame.dataProvider.length - 1) { lastIndex = chartPointsPerGame.dataProvider.length - 1; /* Si on a plus que 25 parties dans l'année, on check les 25 dernières */ if (lastIndex >= 25) { firstIndex = lastIndex - 25; } } chartPointsPerGame.zoomToIndexes(firstIndex, lastIndex); } function zoomChartYearlyProgression(){ chartYearlyProgression.zoomToIndexes(0, chartYearlyProgression.dataProvider.length - 1); } function zoomChartYearlyProgressionVictories(){ chartYearlyProgressionVictories.zoomToIndexes(0, chartYearlyProgressionVictories.dataProvider.length - 1); } function zoomChartTotalEfficiencyProgression(){ chartTotalEfficiencyProgression.zoomToIndexes(0, chartTotalEfficiencyProgression.dataProvider.length - 1); } function zoomChartTotalProduction(){ chartTotalProduction.zoomToIndexes(0, chartTotalProduction.dataProvider.length - 1); } /* test re-upload */