var reader; var selectedSeries = 0; var sortFn = sortByMean; var animeJSON = [[ {"anime": "Gintama", "episodeNumber": 201, "ratings": [240, 27, 19, 3, 6], "numVotes": 295, "mean": 4.667796610169492}, {"anime": "Gintama", "episodeNumber": 178, "ratings": [89, 10, 9, 1, 3], "numVotes": 112, "mean": 4.616071428571429}, {"anime": "Gintama", "episodeNumber": 174, "ratings": [58, 18, 11, 2, 1], "numVotes": 90, "mean": 4.444444444444445}, {"anime": "Gintama", "episodeNumber": 175, "ratings": [64, 25, 9, 4, 0], "numVotes": 102, "mean": 4.46078431372549}, {"anime": "Gintama", "episodeNumber": 177, "ratings": [110, 20, 1, 1, 1], "numVotes": 133, "mean": 4.7819548872180455}, {"anime": "Gintama", "episodeNumber": 176, "ratings": [57, 19, 12, 6, 4], "numVotes": 98, "mean": 4.214285714285714}, {"anime": "Gintama", "episodeNumber": 179, "ratings": [112, 7, 4, 1, 0], "numVotes": 124, "mean": 4.854838709677419}, {"anime": "Gintama", "episodeNumber": 180, "ratings": [144, 17, 4, 1, 3], "numVotes": 169, "mean": 4.763313609467455}, {"anime": "Gintama", "episodeNumber": 181, "ratings": [101, 21, 5, 2, 0], "numVotes": 129, "mean": 4.713178294573644}, {"anime": "Gintama", "episodeNumber": 186, "ratings": [72, 22, 4, 1, 1], "numVotes": 100, "mean": 4.63}, {"anime": "Gintama", "episodeNumber": 185, "ratings": [67, 17, 7, 2, 0], "numVotes": 93, "mean": 4.602150537634409}, {"anime": "Gintama", "episodeNumber": 182, "ratings": [138, 10, 6, 2, 0], "numVotes": 156, "mean": 4.82051282051282}, {"anime": "Gintama", "episodeNumber": 183, "ratings": [165, 10, 5, 1, 0], "numVotes": 181, "mean": 4.87292817679558}, {"anime": "Gintama", "episodeNumber": 188, "ratings": [278, 11, 1, 1, 0], "numVotes": 291, "mean": 4.945017182130584}, {"anime": "Gintama", "episodeNumber": 184, "ratings": [135, 12, 3, 3, 0], "numVotes": 153, "mean": 4.823529411764706}, {"anime": "Gintama", "episodeNumber": 154, "ratings": [75, 21, 7, 0, 0], "numVotes": 103, "mean": 4.660194174757281}, {"anime": "Gintama", "episodeNumber": 187, "ratings": [102, 15, 7, 1, 1], "numVotes": 126, "mean": 4.714285714285714}, {"anime": "Gintama", "episodeNumber": 152, "ratings": [178, 13, 6, 1, 0], "numVotes": 198, "mean": 4.858585858585859}, {"anime": "Gintama", "episodeNumber": 158, "ratings": [43, 18, 12, 2, 1], "numVotes": 76, "mean": 4.315789473684211}, {"anime": "Gintama", "episodeNumber": 157, "ratings": [40, 22, 17, 5, 3], "numVotes": 87, "mean": 4.045977011494253}, {"anime": "Gintama", "episodeNumber": 156, "ratings": [115, 33, 10, 5, 4], "numVotes": 167, "mean": 4.497005988023952}, {"anime": "Gintama", "episodeNumber": 155, "ratings": [38, 17, 11, 5, 0], "numVotes": 71, "mean": 4.23943661971831}, {"anime": "Gintama", "episodeNumber": 159, "ratings": [62, 24, 4, 0, 0], "numVotes": 90, "mean": 4.644444444444445}, {"anime": "Gintama", "episodeNumber": 160, "ratings": [102, 12, 6, 1, 1], "numVotes": 122, "mean": 4.745901639344262}, {"anime": "Gintama", "episodeNumber": 153, "ratings": [192, 16, 6, 1, 0], "numVotes": 215, "mean": 4.855813953488372}, {"anime": "Gintama", "episodeNumber": 161, "ratings": [63, 19, 1, 1, 0], "numVotes": 84, "mean": 4.714285714285714}, {"anime": "Gintama", "episodeNumber": 163, "ratings": [61, 31, 6, 4, 1], "numVotes": 103, "mean": 4.427184466019417}, {"anime": "Gintama", "episodeNumber": 167, "ratings": [56, 26, 8, 3, 0], "numVotes": 93, "mean": 4.451612903225806}, {"anime": "Gintama", "episodeNumber": 168, "ratings": [51, 19, 10, 2, 1], "numVotes": 83, "mean": 4.409638554216867}, {"anime": "Gintama", "episodeNumber": 165, "ratings": [125, 17, 5, 4, 0], "numVotes": 151, "mean": 4.741721854304636}, {"anime": "Gintama", "episodeNumber": 162, "ratings": [45, 20, 8, 3, 2], "numVotes": 78, "mean": 4.32051282051282}, {"anime": "Gintama", "episodeNumber": 166, "ratings": [159, 19, 5, 3, 1], "numVotes": 187, "mean": 4.775401069518717}, {"anime": "Gintama", "episodeNumber": 164, "ratings": [27, 18, 20, 16, 7], "numVotes": 88, "mean": 3.477272727272727}, {"anime": "Gintama", "episodeNumber": 169, "ratings": [57, 13, 8, 1, 2], "numVotes": 81, "mean": 4.506172839506172}, {"anime": "Gintama", "episodeNumber": 170, "ratings": [54, 24, 12, 2, 1], "numVotes": 93, "mean": 4.376344086021505}, {"anime": "Gintama", "episodeNumber": 173, "ratings": [105, 10, 3, 1, 0], "numVotes": 119, "mean": 4.840336134453781}, {"anime": "Gintama", "episodeNumber": 172, "ratings": [50, 18, 8, 3, 0], "numVotes": 79, "mean": 4.455696202531645}, {"anime": "Gintama", "episodeNumber": 171, "ratings": [80, 15, 5, 1, 0], "numVotes": 101, "mean": 4.7227722772277225}, {"anime": "Gintama", "episodeNumber": 190, "ratings": [127, 10, 3, 0, 0], "numVotes": 140, "mean": 4.885714285714286}, {"anime": "Gintama", "episodeNumber": 191, "ratings": [101, 14, 2, 1, 0], "numVotes": 118, "mean": 4.822033898305085}, {"anime": "Gintama", "episodeNumber": 103, "ratings": [145, 9, 1, 1, 0], "numVotes": 156, "mean": 4.910256410256411}, {"anime": "Gintama", "episodeNumber": 104, "ratings": [129, 7, 1, 2, 1], "numVotes": 140, "mean": 4.864285714285714}, {"anime": "Gintama", "episodeNumber": 102, "ratings": [116, 12, 1, 0, 0], "numVotes": 129, "mean": 4.891472868217054}, {"anime": "Gintama", "episodeNumber": 106, "ratings": [80, 26, 15, 1, 0], "numVotes": 122, "mean": 4.516393442622951}, {"anime": "Gintama", "episodeNumber": 189, "ratings": [169, 24, 8, 3, 2], "numVotes": 206, "mean": 4.723300970873787}, {"anime": "Gintama", "episodeNumber": 107, "ratings": [57, 27, 9, 1, 1], "numVotes": 95, "mean": 4.4526315789473685}, {"anime": "Gintama", "episodeNumber": 105, "ratings": [165, 15, 2, 0, 0], "numVotes": 182, "mean": 4.895604395604396}, {"anime": "Gintama", "episodeNumber": 109, "ratings": [124, 31, 6, 2, 0], "numVotes": 163, "mean": 4.699386503067485}, {"anime": "Gintama", "episodeNumber": 108, "ratings": [75, 40, 8, 3, 1], "numVotes": 127, "mean": 4.456692913385827}, {"anime": "Gintama", "episodeNumber": 110, "ratings": [208, 23, 2, 0, 0], "numVotes": 233, "mean": 4.884120171673819}, {"anime": "Gintama", "episodeNumber": 114, "ratings": [127, 19, 2, 0, 0], "numVotes": 148, "mean": 4.844594594594595}, {"anime": "Gintama", "episodeNumber": 112, "ratings": [104, 27, 6, 0, 0], "numVotes": 137, "mean": 4.7153284671532845}, {"anime": "Gintama", "episodeNumber": 113, "ratings": [169, 26, 6, 2, 1], "numVotes": 204, "mean": 4.764705882352941}, {"anime": "Gintama", "episodeNumber": 111, "ratings": [155, 35, 8, 0, 0], "numVotes": 198, "mean": 4.742424242424242}, {"anime": "Gintama", "episodeNumber": 118, "ratings": [93, 31, 8, 3, 2], "numVotes": 137, "mean": 4.532846715328467}, {"anime": "Gintama", "episodeNumber": 116, "ratings": [75, 11, 6, 2, 0], "numVotes": 94, "mean": 4.691489361702128}, {"anime": "Gintama", "episodeNumber": 115, "ratings": [127, 19, 5, 0, 0], "numVotes": 151, "mean": 4.80794701986755}, {"anime": "Gintama", "episodeNumber": 117, "ratings": [61, 20, 8, 1, 2], "numVotes": 92, "mean": 4.489130434782608}, {"anime": "Gintama", "episodeNumber": 119, "ratings": [147, 19, 7, 1, 0], "numVotes": 174, "mean": 4.793103448275862}, {"anime": "Gintama", "episodeNumber": 121, "ratings": [97, 18, 2, 1, 0], "numVotes": 118, "mean": 4.788135593220339}, {"anime": "Gintama", "episodeNumber": 120, "ratings": [125, 14, 2, 1, 0], "numVotes": 142, "mean": 4.852112676056338}, {"anime": "Gintama", "episodeNumber": 122, "ratings": [92, 13, 4, 0, 0], "numVotes": 109, "mean": 4.807339449541284}, {"anime": "Gintama", "episodeNumber": 123, "ratings": [96, 15, 9, 2, 1], "numVotes": 123, "mean": 4.650406504065041}, {"anime": "Gintama", "episodeNumber": 125, "ratings": [66, 19, 12, 3, 2], "numVotes": 102, "mean": 4.411764705882353}, {"anime": "Gintama", "episodeNumber": 126, "ratings": [64, 15, 3, 2, 0], "numVotes": 84, "mean": 4.678571428571429}, {"anime": "Gintama", "episodeNumber": 124, "ratings": [38, 34, 17, 13, 8], "numVotes": 110, "mean": 3.7363636363636363}, {"anime": "Gintama", "episodeNumber": 53, "ratings": [82, 37, 11, 2, 1], "numVotes": 133, "mean": 4.481203007518797}, {"anime": "Gintama", "episodeNumber": 55, "ratings": [87, 30, 14, 1, 0], "numVotes": 132, "mean": 4.537878787878788}, {"anime": "Gintama", "episodeNumber": 52, "ratings": [122, 20, 4, 1, 0], "numVotes": 147, "mean": 4.789115646258503}, {"anime": "Gintama", "episodeNumber": 57, "ratings": [84, 30, 14, 0, 0], "numVotes": 128, "mean": 4.546875}, {"anime": "Gintama", "episodeNumber": 54, "ratings": [97, 34, 10, 1, 1], "numVotes": 143, "mean": 4.573426573426573}, {"anime": "Gintama", "episodeNumber": 56, "ratings": [157, 15, 7, 1, 1], "numVotes": 181, "mean": 4.801104972375691}, {"anime": "Gintama", "episodeNumber": 58, "ratings": [158, 12, 5, 1, 0], "numVotes": 176, "mean": 4.857954545454546}, {"anime": "Gintama", "episodeNumber": 59, "ratings": [126, 21, 2, 1, 1], "numVotes": 151, "mean": 4.788079470198675}, {"anime": "Gintama", "episodeNumber": 60, "ratings": [136, 15, 3, 1, 0], "numVotes": 155, "mean": 4.84516129032258}, {"anime": "Gintama", "episodeNumber": 61, "ratings": [267, 6, 6, 3, 4], "numVotes": 286, "mean": 4.84965034965035}, {"anime": "Gintama", "episodeNumber": 68, "ratings": [51, 23, 18, 4, 1], "numVotes": 97, "mean": 4.22680412371134}, {"anime": "Gintama", "episodeNumber": 67, "ratings": [45, 15, 120, 1, 0], "numVotes": 181, "mean": 3.574585635359116}, {"anime": "Gintama", "episodeNumber": 62, "ratings": [148, 19, 4, 0, 0], "numVotes": 171, "mean": 4.842105263157895}, {"anime": "Gintama", "episodeNumber": 64, "ratings": [140, 19, 4, 2, 1], "numVotes": 166, "mean": 4.77710843373494}, {"anime": "Gintama", "episodeNumber": 63, "ratings": [67, 36, 5, 0, 0], "numVotes": 108, "mean": 4.574074074074074}, {"anime": "Gintama", "episodeNumber": 65, "ratings": [149, 21, 2, 0, 0], "numVotes": 172, "mean": 4.854651162790698}, {"anime": "Gintama", "episodeNumber": 66, "ratings": [98, 20, 12, 1, 1], "numVotes": 132, "mean": 4.613636363636363}, {"anime": "Gintama", "episodeNumber": 69, "ratings": [83, 20, 6, 1, 0], "numVotes": 110, "mean": 4.681818181818182}, {"anime": "Gintama", "episodeNumber": 70, "ratings": [72, 19, 6, 3, 2], "numVotes": 102, "mean": 4.529411764705882}, {"anime": "Gintama", "episodeNumber": 72, "ratings": [117, 19, 5, 2, 0], "numVotes": 143, "mean": 4.755244755244755}, {"anime": "Gintama", "episodeNumber": 73, "ratings": [50, 30, 15, 6, 2], "numVotes": 103, "mean": 4.165048543689321}, {"anime": "Gintama", "episodeNumber": 71, "ratings": [145, 19, 6, 2, 3], "numVotes": 175, "mean": 4.72}, {"anime": "Gintama", "episodeNumber": 2, "ratings": [55, 45, 27, 7, 3], "numVotes": 137, "mean": 4.036496350364963}, {"anime": "Gintama", "episodeNumber": 5, "ratings": [84, 56, 20, 2, 2], "numVotes": 164, "mean": 4.329268292682927}, {"anime": "Gintama", "episodeNumber": 3, "ratings": [57, 53, 44, 12, 1], "numVotes": 167, "mean": 3.9161676646706587}, {"anime": "Gintama", "episodeNumber": 4, "ratings": [60, 54, 34, 1, 1], "numVotes": 150, "mean": 4.14}, {"anime": "Gintama", "episodeNumber": 6, "ratings": [64, 61, 29, 4, 2], "numVotes": 160, "mean": 4.13125}, {"anime": "Gintama", "episodeNumber": 8, "ratings": [116, 50, 9, 1, 1], "numVotes": 177, "mean": 4.576271186440678}, {"anime": "Gintama", "episodeNumber": 7, "ratings": [87, 46, 21, 3, 5], "numVotes": 162, "mean": 4.277777777777778}, {"anime": "Gintama", "episodeNumber": 9, "ratings": [95, 38, 10, 1, 1], "numVotes": 145, "mean": 4.551724137931035}, {"anime": "Gintama", "episodeNumber": 10, "ratings": [100, 34, 7, 1, 1], "numVotes": 143, "mean": 4.615384615384615}, {"anime": "Gintama", "episodeNumber": 11, "ratings": [71, 28, 10, 2, 0], "numVotes": 111, "mean": 4.513513513513513}, {"anime": "Gintama", "episodeNumber": 12, "ratings": [75, 37, 14, 1, 1], "numVotes": 128, "mean": 4.4375}, {"anime": "Gintama", "episodeNumber": 14, "ratings": [70, 47, 11, 3, 1], "numVotes": 132, "mean": 4.378787878787879}, {"anime": "Gintama", "episodeNumber": 13, "ratings": [134, 28, 7, 1, 1], "numVotes": 171, "mean": 4.713450292397661}, {"anime": "Gintama", "episodeNumber": 16, "ratings": [71, 35, 11, 2, 1], "numVotes": 120, "mean": 4.441666666666666}, {"anime": "Gintama", "episodeNumber": 17, "ratings": [77, 37, 12, 3, 1], "numVotes": 130, "mean": 4.430769230769231}, {"anime": "Gintama", "episodeNumber": 15, "ratings": [77, 39, 9, 3, 2], "numVotes": 130, "mean": 4.430769230769231}, {"anime": "Gintama", "episodeNumber": 18, "ratings": [141, 26, 9, 5, 3], "numVotes": 184, "mean": 4.614130434782608}, {"anime": "Gintama", "episodeNumber": 19, "ratings": [74, 36, 22, 3, 3], "numVotes": 138, "mean": 4.268115942028985}, {"anime": "Gintama", "episodeNumber": 20, "ratings": [170, 25, 12, 1, 3], "numVotes": 211, "mean": 4.696682464454977}, {"anime": "Gintama", "episodeNumber": 21, "ratings": [93, 43, 12, 3, 3], "numVotes": 154, "mean": 4.428571428571429}, {"anime": "Gintama", "episodeNumber": 22, "ratings": [127, 26, 5, 3, 0], "numVotes": 161, "mean": 4.720496894409938}, {"anime": "Gintama", "episodeNumber": 24, "ratings": [78, 38, 16, 8, 3], "numVotes": 143, "mean": 4.258741258741258}, {"anime": "Gintama", "episodeNumber": 23, "ratings": [72, 47, 18, 2, 1], "numVotes": 140, "mean": 4.335714285714285}, {"anime": "Gintama", "episodeNumber": 1, "ratings": [76, 56, 51, 21, 10], "numVotes": 214, "mean": 3.7803738317757007}, {"anime": "Gintama", "episodeNumber": 26, "ratings": [70, 30, 21, 4, 2], "numVotes": 127, "mean": 4.275590551181103}, {"anime": "Gintama", "episodeNumber": 25, "ratings": [430, 33, 16, 3, 3], "numVotes": 485, "mean": 4.822680412371134}, {"anime": "Gintama", "episodeNumber": 28, "ratings": [124, 31, 7, 4, 0], "numVotes": 166, "mean": 4.656626506024097}, {"anime": "Gintama", "episodeNumber": 27, "ratings": [104, 38, 6, 4, 1], "numVotes": 153, "mean": 4.568627450980392}, {"anime": "Gintama", "episodeNumber": 29, "ratings": [103, 25, 7, 1, 1], "numVotes": 137, "mean": 4.664233576642336}, {"anime": "Gintama", "episodeNumber": 31, "ratings": [123, 19, 12, 2, 0], "numVotes": 156, "mean": 4.685897435897436}, {"anime": "Gintama", "episodeNumber": 30, "ratings": [67, 32, 19, 1, 1], "numVotes": 120, "mean": 4.358333333333333}, {"anime": "Gintama", "episodeNumber": 33, "ratings": [102, 33, 14, 0, 0], "numVotes": 149, "mean": 4.590604026845638}, {"anime": "Gintama", "episodeNumber": 32, "ratings": [110, 22, 5, 0, 0], "numVotes": 137, "mean": 4.766423357664234}, {"anime": "Gintama", "episodeNumber": 36, "ratings": [36, 39, 27, 5, 1], "numVotes": 108, "mean": 3.962962962962963}, {"anime": "Gintama", "episodeNumber": 35, "ratings": [147, 25, 4, 1, 0], "numVotes": 177, "mean": 4.796610169491525}, {"anime": "Gintama", "episodeNumber": 37, "ratings": [99, 31, 8, 2, 1], "numVotes": 141, "mean": 4.595744680851064}, {"anime": "Gintama", "episodeNumber": 34, "ratings": [224, 18, 3, 2, 0], "numVotes": 247, "mean": 4.8785425101214575}, {"anime": "Gintama", "episodeNumber": 38, "ratings": [93, 37, 11, 3, 2], "numVotes": 146, "mean": 4.47945205479452}, {"anime": "Gintama", "episodeNumber": 39, "ratings": [140, 31, 5, 0, 0], "numVotes": 176, "mean": 4.767045454545454}, {"anime": "Gintama", "episodeNumber": 40, "ratings": [99, 31, 9, 1, 0], "numVotes": 140, "mean": 4.628571428571429}, {"anime": "Gintama", "episodeNumber": 41, "ratings": [108, 19, 3, 0, 0], "numVotes": 130, "mean": 4.8076923076923075}, {"anime": "Gintama", "episodeNumber": 42, "ratings": [158, 24, 4, 1, 2], "numVotes": 189, "mean": 4.772486772486772}, {"anime": "Gintama", "episodeNumber": 43, "ratings": [107, 23, 8, 3, 0], "numVotes": 141, "mean": 4.659574468085107}, {"anime": "Gintama", "episodeNumber": 44, "ratings": [135, 27, 9, 2, 0], "numVotes": 173, "mean": 4.705202312138728}, {"anime": "Gintama", "episodeNumber": 46, "ratings": [109, 34, 9, 3, 5], "numVotes": 160, "mean": 4.49375}, {"anime": "Gintama", "episodeNumber": 45, "ratings": [107, 33, 3, 1, 0], "numVotes": 144, "mean": 4.708333333333333}, {"anime": "Gintama", "episodeNumber": 47, "ratings": [123, 24, 13, 0, 0], "numVotes": 160, "mean": 4.6875}, {"anime": "Gintama", "episodeNumber": 48, "ratings": [119, 35, 7, 1, 1], "numVotes": 163, "mean": 4.656441717791411}, {"anime": "Gintama", "episodeNumber": 49, "ratings": [75, 47, 17, 3, 2], "numVotes": 144, "mean": 4.319444444444445}, {"anime": "Gintama", "episodeNumber": 74, "ratings": [102, 28, 1, 0, 0], "numVotes": 131, "mean": 4.770992366412214}, {"anime": "Gintama", "episodeNumber": 50, "ratings": [228, 31, 1, 3, 0], "numVotes": 263, "mean": 4.840304182509506}, {"anime": "Gintama", "episodeNumber": 51, "ratings": [105, 17, 4, 0, 0], "numVotes": 126, "mean": 4.801587301587301}, {"anime": "Gintama", "episodeNumber": 75, "ratings": [90, 36, 16, 9, 4], "numVotes": 155, "mean": 4.283870967741936}, {"anime": "Gintama", "episodeNumber": 77, "ratings": [138, 9, 0, 0, 0], "numVotes": 147, "mean": 4.938775510204081}, {"anime": "Gintama", "episodeNumber": 76, "ratings": [34, 1, 93, 16, 0], "numVotes": 144, "mean": 3.3680555555555554}, {"anime": "Gintama", "episodeNumber": 78, "ratings": [97, 15, 1, 0, 0], "numVotes": 113, "mean": 4.849557522123894}, {"anime": "Gintama", "episodeNumber": 79, "ratings": [276, 13, 1, 1, 0], "numVotes": 291, "mean": 4.938144329896907}, {"anime": "Gintama", "episodeNumber": 82, "ratings": [56, 27, 16, 4, 2], "numVotes": 105, "mean": 4.247619047619048}, {"anime": "Gintama", "episodeNumber": 81, "ratings": [155, 14, 4, 0, 0], "numVotes": 173, "mean": 4.872832369942197}, {"anime": "Gintama", "episodeNumber": 80, "ratings": [103, 20, 3, 0, 0], "numVotes": 126, "mean": 4.7936507936507935}, {"anime": "Gintama", "episodeNumber": 84, "ratings": [38, 13, 53, 60, 38], "numVotes": 202, "mean": 2.767326732673267}, {"anime": "Gintama", "episodeNumber": 85, "ratings": [63, 44, 20, 12, 5], "numVotes": 144, "mean": 4.027777777777778}, {"anime": "Gintama", "episodeNumber": 83, "ratings": [167, 28, 3, 0, 0], "numVotes": 198, "mean": 4.828282828282828}, {"anime": "Gintama", "episodeNumber": 86, "ratings": [160, 14, 4, 0, 0], "numVotes": 178, "mean": 4.876404494382022}, {"anime": "Gintama", "episodeNumber": 88, "ratings": [148, 19, 4, 2, 1], "numVotes": 174, "mean": 4.787356321839081}, {"anime": "Gintama", "episodeNumber": 87, "ratings": [411, 14, 6, 4, 0], "numVotes": 435, "mean": 4.9126436781609195}, {"anime": "Gintama", "episodeNumber": 89, "ratings": [99, 25, 16, 3, 0], "numVotes": 143, "mean": 4.538461538461538}, {"anime": "Gintama", "episodeNumber": 90, "ratings": [83, 40, 6, 1, 0], "numVotes": 130, "mean": 4.576923076923077}, {"anime": "Gintama", "episodeNumber": 91, "ratings": [96, 20, 8, 3, 2], "numVotes": 129, "mean": 4.589147286821706}, {"anime": "Gintama", "episodeNumber": 92, "ratings": [134, 22, 4, 1, 2], "numVotes": 163, "mean": 4.748466257668712}, {"anime": "Gintama", "episodeNumber": 93, "ratings": [40, 26, 32, 12, 4], "numVotes": 114, "mean": 3.754385964912281}, {"anime": "Gintama", "episodeNumber": 94, "ratings": [76, 28, 7, 0, 0], "numVotes": 111, "mean": 4.621621621621622}, {"anime": "Gintama", "episodeNumber": 96, "ratings": [120, 30, 11, 9, 4], "numVotes": 174, "mean": 4.454022988505747}, {"anime": "Gintama", "episodeNumber": 95, "ratings": [110, 19, 3, 0, 0], "numVotes": 132, "mean": 4.8106060606060606}, {"anime": "Gintama", "episodeNumber": 97, "ratings": [92, 27, 10, 0, 0], "numVotes": 129, "mean": 4.635658914728682}, {"anime": "Gintama", "episodeNumber": 98, "ratings": [131, 22, 4, 0, 0], "numVotes": 157, "mean": 4.808917197452229}, {"anime": "Gintama", "episodeNumber": 100, "ratings": [122, 24, 12, 4, 0], "numVotes": 162, "mean": 4.62962962962963}, {"anime": "Gintama", "episodeNumber": 101, "ratings": [93, 26, 5, 2, 0], "numVotes": 126, "mean": 4.666666666666667}, {"anime": "Gintama", "episodeNumber": 99, "ratings": [348, 9, 3, 1, 0], "numVotes": 361, "mean": 4.950138504155125}, {"anime": "Gintama", "episodeNumber": 127, "ratings": [107, 9, 1, 0, 0], "numVotes": 117, "mean": 4.905982905982906}, {"anime": "Gintama", "episodeNumber": 128, "ratings": [110, 14, 5, 1, 7], "numVotes": 137, "mean": 4.598540145985401}, {"anime": "Gintama", "episodeNumber": 129, "ratings": [42, 22, 10, 2, 1], "numVotes": 77, "mean": 4.324675324675325}, {"anime": "Gintama", "episodeNumber": 130, "ratings": [154, 23, 9, 5, 0], "numVotes": 191, "mean": 4.706806282722513}, {"anime": "Gintama", "episodeNumber": 132, "ratings": [48, 17, 10, 1, 2], "numVotes": 78, "mean": 4.384615384615385}, {"anime": "Gintama", "episodeNumber": 133, "ratings": [50, 20, 7, 1, 0], "numVotes": 78, "mean": 4.5256410256410255}, {"anime": "Gintama", "episodeNumber": 131, "ratings": [71, 14, 5, 1, 0], "numVotes": 91, "mean": 4.7032967032967035}, {"anime": "Gintama", "episodeNumber": 137, "ratings": [32, 21, 11, 1, 0], "numVotes": 65, "mean": 4.292307692307692}, {"anime": "Gintama", "episodeNumber": 135, "ratings": [54, 19, 13, 0, 0], "numVotes": 86, "mean": 4.476744186046512}, {"anime": "Gintama", "episodeNumber": 136, "ratings": [81, 22, 16, 8, 1], "numVotes": 128, "mean": 4.359375}, {"anime": "Gintama", "episodeNumber": 134, "ratings": [63, 32, 13, 4, 3], "numVotes": 115, "mean": 4.28695652173913}, {"anime": "Gintama", "episodeNumber": 138, "ratings": [70, 21, 4, 4, 5], "numVotes": 104, "mean": 4.413461538461538}, {"anime": "Gintama", "episodeNumber": 141, "ratings": [92, 9, 2, 0, 0], "numVotes": 103, "mean": 4.87378640776699}, {"anime": "Gintama", "episodeNumber": 139, "ratings": [78, 15, 1, 1, 0], "numVotes": 95, "mean": 4.7894736842105265}, {"anime": "Gintama", "episodeNumber": 140, "ratings": [124, 6, 1, 1, 0], "numVotes": 132, "mean": 4.916666666666667}, {"anime": "Gintama", "episodeNumber": 143, "ratings": [107, 4, 1, 1, 0], "numVotes": 113, "mean": 4.920353982300885}, {"anime": "Gintama", "episodeNumber": 142, "ratings": [291, 3, 4, 2, 0], "numVotes": 300, "mean": 4.943333333333333}, {"anime": "Gintama", "episodeNumber": 144, "ratings": [90, 8, 1, 1, 0], "numVotes": 100, "mean": 4.87}, {"anime": "Gintama", "episodeNumber": 145, "ratings": [111, 16, 3, 5, 0], "numVotes": 135, "mean": 4.725925925925926}, {"anime": "Gintama", "episodeNumber": 148, "ratings": [74, 16, 7, 2, 0], "numVotes": 99, "mean": 4.636363636363637}, {"anime": "Gintama", "episodeNumber": 146, "ratings": [107, 19, 8, 2, 1], "numVotes": 137, "mean": 4.671532846715328}, {"anime": "Gintama", "episodeNumber": 147, "ratings": [71, 19, 6, 1, 0], "numVotes": 97, "mean": 4.649484536082475}, {"anime": "Gintama", "episodeNumber": 149, "ratings": [97, 11, 5, 6, 3], "numVotes": 122, "mean": 4.581967213114754}, {"anime": "Gintama", "episodeNumber": 150, "ratings": [139, 17, 6, 3, 3], "numVotes": 168, "mean": 4.7023809523809526}, {"anime": "Gintama", "episodeNumber": 151, "ratings": [78, 18, 4, 0, 0], "numVotes": 100, "mean": 4.74}, {"anime": "Gintama", "episodeNumber": 192, "ratings": [98, 15, 4, 1, 0], "numVotes": 118, "mean": 4.779661016949152}, {"anime": "Gintama", "episodeNumber": 193, "ratings": [32, 18, 20, 11, 7], "numVotes": 88, "mean": 3.647727272727273}, {"anime": "Gintama", "episodeNumber": 195, "ratings": [96, 6, 5, 0, 0], "numVotes": 107, "mean": 4.850467289719626}, {"anime": "Gintama", "episodeNumber": 196, "ratings": [68, 16, 6, 0, 0], "numVotes": 90, "mean": 4.688888888888889}, {"anime": "Gintama", "episodeNumber": 194, "ratings": [83, 25, 9, 2, 2], "numVotes": 121, "mean": 4.528925619834711}, {"anime": "Gintama", "episodeNumber": 198, "ratings": [61, 17, 4, 2, 0], "numVotes": 84, "mean": 4.630952380952381}, {"anime": "Gintama", "episodeNumber": 197, "ratings": [169, 11, 6, 0, 0], "numVotes": 186, "mean": 4.876344086021505}, {"anime": "Gintama", "episodeNumber": 199, "ratings": [82, 10, 5, 2, 0], "numVotes": 99, "mean": 4.737373737373737}, {"anime": "Gintama", "episodeNumber": 200, "ratings": [91, 18, 5, 1, 0], "numVotes": 115, "mean": 4.730434782608696} ], [ {"episodeNumber": 51, "ratings": [228, 29, 16, 3, 4], "numVotes": 280, "anime": "Gintama'", "mean": 4.692857142857143}, {"episodeNumber": 19, "ratings": [201, 13, 4, 2, 2], "numVotes": 222, "anime": "Gintama'", "mean": 4.842342342342342}, {"episodeNumber": 24, "ratings": [84, 25, 12, 0, 0], "numVotes": 121, "anime": "Gintama'", "mean": 4.595041322314049}, {"episodeNumber": 22, "ratings": [97, 21, 3, 2, 0], "numVotes": 123, "anime": "Gintama'", "mean": 4.7317073170731705}, {"episodeNumber": 20, "ratings": [72, 34, 13, 7, 6], "numVotes": 132, "anime": "Gintama'", "mean": 4.204545454545454}, {"episodeNumber": 23, "ratings": [103, 38, 21, 4, 3], "numVotes": 169, "anime": "Gintama'", "mean": 4.384615384615385}, {"episodeNumber": 25, "ratings": [114, 18, 5, 2, 0], "numVotes": 139, "anime": "Gintama'", "mean": 4.755395683453237}, {"episodeNumber": 21, "ratings": [66, 19, 12, 6, 4], "numVotes": 107, "anime": "Gintama'", "mean": 4.280373831775701}, {"episodeNumber": 18, "ratings": [110, 25, 7, 2, 0], "numVotes": 144, "anime": "Gintama'", "mean": 4.6875}, {"episodeNumber": 27, "ratings": [82, 6, 5, 1, 0], "numVotes": 94, "anime": "Gintama'", "mean": 4.797872340425532}, {"episodeNumber": 26, "ratings": [179, 23, 19, 4, 1], "numVotes": 226, "anime": "Gintama'", "mean": 4.65929203539823}, {"episodeNumber": 30, "ratings": [173, 23, 7, 3, 2], "numVotes": 208, "anime": "Gintama'", "mean": 4.740384615384615}, {"episodeNumber": 32, "ratings": [84, 15, 8, 2, 1], "numVotes": 110, "anime": "Gintama'", "mean": 4.627272727272727}, {"episodeNumber": 31, "ratings": [122, 22, 7, 3, 1], "numVotes": 155, "anime": "Gintama'", "mean": 4.683870967741935}, {"episodeNumber": 28, "ratings": [161, 11, 3, 3, 0], "numVotes": 178, "anime": "Gintama'", "mean": 4.853932584269663}, {"episodeNumber": 29, "ratings": [98, 20, 6, 2, 0], "numVotes": 126, "anime": "Gintama'", "mean": 4.698412698412699}, {"episodeNumber": 2, "ratings": [359, 22, 4, 2, 0], "numVotes": 387, "anime": "Gintama'", "mean": 4.906976744186046}, {"episodeNumber": 3, "ratings": [208, 18, 7, 0, 0], "numVotes": 233, "anime": "Gintama'", "mean": 4.8626609442060085}, {"episodeNumber": 6, "ratings": [111, 30, 3, 1, 0], "numVotes": 145, "anime": "Gintama'", "mean": 4.731034482758621}, {"episodeNumber": 5, "ratings": [140, 37, 13, 3, 3], "numVotes": 196, "anime": "Gintama'", "mean": 4.571428571428571}, {"episodeNumber": 4, "ratings": [137, 34, 7, 1, 0], "numVotes": 179, "anime": "Gintama'", "mean": 4.715083798882682}, {"episodeNumber": 7, "ratings": [131, 25, 13, 3, 0], "numVotes": 172, "anime": "Gintama'", "mean": 4.651162790697675}, {"episodeNumber": 9, "ratings": [125, 14, 5, 1, 1], "numVotes": 146, "anime": "Gintama'", "mean": 4.787671232876712}, {"episodeNumber": 8, "ratings": [101, 33, 23, 14, 4], "numVotes": 175, "anime": "Gintama'", "mean": 4.217142857142857}, {"episodeNumber": 11, "ratings": [177, 14, 1, 3, 1], "numVotes": 196, "anime": "Gintama'", "mean": 4.8520408163265305}, {"episodeNumber": 12, "ratings": [186, 9, 1, 2, 2], "numVotes": 200, "anime": "Gintama'", "mean": 4.875}, {"episodeNumber": 10, "ratings": [394, 8, 4, 1, 0], "numVotes": 407, "anime": "Gintama'", "mean": 4.953316953316953}, {"episodeNumber": 17, "ratings": [92, 30, 17, 2, 0], "numVotes": 141, "anime": "Gintama'", "mean": 4.50354609929078}, {"episodeNumber": 16, "ratings": [183, 14, 4, 0, 0], "numVotes": 201, "anime": "Gintama'", "mean": 4.890547263681592}, {"episodeNumber": 13, "ratings": [277, 13, 2, 2, 0], "numVotes": 294, "anime": "Gintama'", "mean": 4.921768707482993}, {"episodeNumber": 14, "ratings": [177, 21, 3, 1, 2], "numVotes": 204, "anime": "Gintama'", "mean": 4.813725490196078}, {"episodeNumber": 15, "ratings": [163, 22, 8, 2, 2], "numVotes": 197, "anime": "Gintama'", "mean": 4.7360406091370555}, {"episodeNumber": 34, "ratings": [79, 16, 14, 2, 1], "numVotes": 112, "anime": "Gintama'", "mean": 4.517857142857143}, {"episodeNumber": 33, "ratings": [89, 22, 6, 3, 2], "numVotes": 122, "anime": "Gintama'", "mean": 4.581967213114754}, {"episodeNumber": 1, "ratings": [570, 24, 4, 4, 8], "numVotes": 610, "anime": "Gintama'", "mean": 4.8754098360655735}, {"episodeNumber": 38, "ratings": [276, 8, 2, 2, 1], "numVotes": 289, "anime": "Gintama'", "mean": 4.923875432525952}, {"episodeNumber": 39, "ratings": [267, 11, 2, 2, 0], "numVotes": 282, "anime": "Gintama'", "mean": 4.925531914893617}, {"episodeNumber": 35, "ratings": [119, 20, 11, 3, 3], "numVotes": 156, "anime": "Gintama'", "mean": 4.596153846153846}, {"episodeNumber": 36, "ratings": [135, 13, 2, 0, 0], "numVotes": 150, "anime": "Gintama'", "mean": 4.886666666666667}, {"episodeNumber": 37, "ratings": [136, 14, 5, 1, 3], "numVotes": 159, "anime": "Gintama'", "mean": 4.754716981132075}, {"episodeNumber": 40, "ratings": [156, 11, 2, 1, 0], "numVotes": 170, "anime": "Gintama'", "mean": 4.894117647058824}, {"episodeNumber": 41, "ratings": [106, 27, 10, 1, 1], "numVotes": 145, "anime": "Gintama'", "mean": 4.627586206896551}, {"episodeNumber": 44, "ratings": [95, 15, 5, 1, 2], "numVotes": 118, "anime": "Gintama'", "mean": 4.694915254237288}, {"episodeNumber": 42, "ratings": [101, 27, 8, 3, 1], "numVotes": 140, "anime": "Gintama'", "mean": 4.6}, {"episodeNumber": 45, "ratings": [184, 5, 1, 2, 1], "numVotes": 193, "anime": "Gintama'", "mean": 4.9119170984455955}, {"episodeNumber": 43, "ratings": [106, 14, 4, 1, 3], "numVotes": 128, "anime": "Gintama'", "mean": 4.7109375}, {"episodeNumber": 46, "ratings": [147, 16, 7, 1, 1], "numVotes": 172, "anime": "Gintama'", "mean": 4.784883720930233}, {"episodeNumber": 47, "ratings": [105, 17, 4, 2, 0], "numVotes": 128, "anime": "Gintama'", "mean": 4.7578125}, {"episodeNumber": 49, "ratings": [98, 16, 7, 2, 0], "numVotes": 123, "anime": "Gintama'", "mean": 4.7073170731707314}, {"episodeNumber": 48, "ratings": [103, 20, 5, 1, 1], "numVotes": 130, "anime": "Gintama'", "mean": 4.7153846153846155}, {"episodeNumber": 50, "ratings": [82, 19, 7, 3, 1], "numVotes": 112, "anime": "Gintama'", "mean": 4.589285714285714} ], [ {"episodeNumber": 51, "ratings": [459, 24, 7, 2, 6], "numVotes": 498, "anime": "Gintama\u00b0", "mean": 4.863453815261044}, {"episodeNumber": 23, "ratings": [114, 12, 9, 2, 2], "numVotes": 139, "anime": "Gintama\u00b0", "mean": 4.683453237410072}, {"episodeNumber": 22, "ratings": [159, 11, 3, 0, 0], "numVotes": 173, "anime": "Gintama\u00b0", "mean": 4.901734104046243}, {"episodeNumber": 27, "ratings": [130, 20, 3, 3, 2], "numVotes": 158, "anime": "Gintama\u00b0", "mean": 4.727848101265823}, {"episodeNumber": 25, "ratings": [113, 13, 5, 2, 2], "numVotes": 135, "anime": "Gintama\u00b0", "mean": 4.725925925925926}, {"episodeNumber": 24, "ratings": [172, 17, 5, 4, 7], "numVotes": 205, "anime": "Gintama\u00b0", "mean": 4.673170731707317}, {"episodeNumber": 26, "ratings": [126, 10, 8, 3, 0], "numVotes": 147, "anime": "Gintama\u00b0", "mean": 4.761904761904762}, {"episodeNumber": 28, "ratings": [120, 15, 10, 1, 6], "numVotes": 152, "anime": "Gintama\u00b0", "mean": 4.592105263157895}, {"episodeNumber": 29, "ratings": [137, 16, 3, 2, 0], "numVotes": 158, "anime": "Gintama\u00b0", "mean": 4.822784810126582}, {"episodeNumber": 30, "ratings": [185, 8, 4, 2, 0], "numVotes": 199, "anime": "Gintama\u00b0", "mean": 4.889447236180905}, {"episodeNumber": 31, "ratings": [155, 13, 4, 5, 0], "numVotes": 177, "anime": "Gintama\u00b0", "mean": 4.796610169491525}, {"episodeNumber": 33, "ratings": [63, 30, 20, 5, 5], "numVotes": 123, "anime": "Gintama\u00b0", "mean": 4.146341463414634}, {"episodeNumber": 34, "ratings": [109, 23, 11, 4, 3], "numVotes": 150, "anime": "Gintama\u00b0", "mean": 4.54}, {"episodeNumber": 36, "ratings": [301, 3, 4, 3, 0], "numVotes": 311, "anime": "Gintama\u00b0", "mean": 4.935691318327974}, {"episodeNumber": 32, "ratings": [179, 14, 4, 1, 3], "numVotes": 201, "anime": "Gintama\u00b0", "mean": 4.8159203980099505}, {"episodeNumber": 35, "ratings": [255, 11, 2, 2, 2], "numVotes": 272, "anime": "Gintama\u00b0", "mean": 4.893382352941177}, {"episodeNumber": 2, "ratings": [255, 24, 6, 2, 5], "numVotes": 292, "anime": "Gintama\u00b0", "mean": 4.787671232876712}, {"episodeNumber": 3, "ratings": [213, 28, 10, 5, 0], "numVotes": 256, "anime": "Gintama\u00b0", "mean": 4.75390625}, {"episodeNumber": 4, "ratings": [172, 37, 5, 7, 6], "numVotes": 227, "anime": "Gintama\u00b0", "mean": 4.594713656387666}, {"episodeNumber": 9, "ratings": [98, 39, 22, 7, 4], "numVotes": 170, "anime": "Gintama\u00b0", "mean": 4.294117647058823}, {"episodeNumber": 5, "ratings": [151, 27, 17, 1, 6], "numVotes": 202, "anime": "Gintama\u00b0", "mean": 4.564356435643564}, {"episodeNumber": 7, "ratings": [210, 15, 3, 1, 3], "numVotes": 232, "anime": "Gintama\u00b0", "mean": 4.844827586206897}, {"episodeNumber": 8, "ratings": [206, 14, 2, 3, 0], "numVotes": 225, "anime": "Gintama\u00b0", "mean": 4.88}, {"episodeNumber": 6, "ratings": [219, 19, 8, 1, 5], "numVotes": 252, "anime": "Gintama\u00b0", "mean": 4.76984126984127}, {"episodeNumber": 10, "ratings": [334, 13, 1, 6, 0], "numVotes": 354, "anime": "Gintama\u00b0", "mean": 4.906779661016949}, {"episodeNumber": 12, "ratings": [135, 26, 6, 1, 7], "numVotes": 175, "anime": "Gintama\u00b0", "mean": 4.605714285714286}, {"episodeNumber": 11, "ratings": [177, 17, 1, 5, 0], "numVotes": 200, "anime": "Gintama\u00b0", "mean": 4.83}, {"episodeNumber": 13, "ratings": [141, 35, 13, 2, 6], "numVotes": 197, "anime": "Gintama\u00b0", "mean": 4.538071065989848}, {"episodeNumber": 16, "ratings": [235, 13, 8, 2, 6], "numVotes": 264, "anime": "Gintama\u00b0", "mean": 4.776515151515151}, {"episodeNumber": 14, "ratings": [191, 20, 4, 3, 0], "numVotes": 218, "anime": "Gintama\u00b0", "mean": 4.830275229357798}, {"episodeNumber": 17, "ratings": [175, 24, 7, 2, 5], "numVotes": 213, "anime": "Gintama\u00b0", "mean": 4.699530516431925}, {"episodeNumber": 18, "ratings": [202, 11, 2, 3, 0], "numVotes": 218, "anime": "Gintama\u00b0", "mean": 4.889908256880734}, {"episodeNumber": 19, "ratings": [146, 15, 2, 1, 1], "numVotes": 165, "anime": "Gintama\u00b0", "mean": 4.842424242424243}, {"episodeNumber": 20, "ratings": [95, 25, 10, 5, 0], "numVotes": 135, "anime": "Gintama\u00b0", "mean": 4.555555555555555}, {"episodeNumber": 21, "ratings": [79, 31, 10, 3, 1], "numVotes": 124, "anime": "Gintama\u00b0", "mean": 4.483870967741935}, {"episodeNumber": 37, "ratings": [182, 11, 1, 2, 0], "numVotes": 196, "anime": "Gintama\u00b0", "mean": 4.903061224489796}, {"episodeNumber": 38, "ratings": [220, 12, 4, 3, 1], "numVotes": 240, "anime": "Gintama\u00b0", "mean": 4.8625}, {"episodeNumber": 40, "ratings": [434, 11, 2, 4, 0], "numVotes": 451, "anime": "Gintama\u00b0", "mean": 4.940133037694014}, {"episodeNumber": 39, "ratings": [309, 6, 2, 1, 2], "numVotes": 320, "anime": "Gintama\u00b0", "mean": 4.934375}, {"episodeNumber": 1, "ratings": [513, 48, 14, 6, 27], "numVotes": 608, "anime": "Gintama\u00b0", "mean": 4.667763157894737}, {"episodeNumber": 41, "ratings": [215, 20, 3, 1, 3], "numVotes": 242, "anime": "Gintama\u00b0", "mean": 4.830578512396694}, {"episodeNumber": 42, "ratings": [300, 14, 3, 1, 4], "numVotes": 322, "anime": "Gintama\u00b0", "mean": 4.87888198757764}, {"episodeNumber": 44, "ratings": [191, 12, 1, 2, 0], "numVotes": 206, "anime": "Gintama\u00b0", "mean": 4.902912621359223}, {"episodeNumber": 43, "ratings": [262, 11, 1, 1, 3], "numVotes": 278, "anime": "Gintama\u00b0", "mean": 4.899280575539568}, {"episodeNumber": 45, "ratings": [152, 10, 1, 1, 0], "numVotes": 164, "anime": "Gintama\u00b0", "mean": 4.908536585365853}, {"episodeNumber": 47, "ratings": [131, 24, 2, 1, 1], "numVotes": 159, "anime": "Gintama\u00b0", "mean": 4.779874213836478}, {"episodeNumber": 46, "ratings": [148, 13, 3, 2, 0], "numVotes": 166, "anime": "Gintama\u00b0", "mean": 4.849397590361446}, {"episodeNumber": 48, "ratings": [155, 13, 4, 1, 1], "numVotes": 174, "anime": "Gintama\u00b0", "mean": 4.839080459770115}, {"episodeNumber": 49, "ratings": [299, 15, 3, 1, 0], "numVotes": 318, "anime": "Gintama\u00b0", "mean": 4.9245283018867925}, {"episodeNumber": 50, "ratings": [287, 10, 4, 1, 4], "numVotes": 306, "anime": "Gintama\u00b0", "mean": 4.879084967320262} ]]; var data; var episodes; $(function(){ $("#g1Radio").change(function(e){ if ($(this).is(':checked')){ selectedSeries = 0; generateChart(); } }); $("#g2Radio").change(function(e){ if ($(this).is(':checked')){ selectedSeries = 1; generateChart(); } }); $("#g3Radio").change(function(e){ if ($(this).is(':checked')){ selectedSeries = 2; generateChart(); } }); $("#meanRadio").change(function(e){ if ($(this).is(':checked')){ sortFn = sortByMean; generateChart(); } }); $("#voteRadio").change(function(e){ if ($(this).is(':checked')){ sortFn = sortByVotes; generateChart(); } }); $("#epNumRadio").change(function(e){ if ($(this).is(':checked')){ sortFn = sortByEpisode; generateChart(); } }); $("#percentRadio").change(function(e){ if ($(this).is(':checked')){ sortFn = sortByFives; generateChart(); } }); generateChart(); }); function sortByVotes(a,b){ if(a.numVotes>b.numVotes) return -1; else if(a.numVotes<b.numVotes) return 1; return 0; } function sortByMean(a,b){ if(a.mean>b.mean) return -1; else if(a.mean<b.mean) return 1; return 0; } function sortByEpisode(a,b){ if(a.episodeNumber>b.episodeNumber) return 1; else if(a.episodeNumber<b.episodeNumber) return -1; return 0; } function sortByFives(a,b){ var percent5A = a.ratings[0]/parseFloat(a.numVotes); var percent5B = b.ratings[0]/parseFloat(b.numVotes); if(percent5A > percent5B) return -1; else if(percent5A < percent5B) return 1; return 0; } function generateChart(){ animeJSON[selectedSeries].sort(sortFn); data = [[],[],[],[],[],[]]; episodes = []; for(episode of animeJSON[selectedSeries]){ var offset = 0; switch(selectedSeries){ case 0: offset = 0; break; case 1: offset = 201; break; case 2: offset = 265; break; } episodes.push("Episode " + (parseInt(episode.episodeNumber) + offset)); data[0].push(episode.mean); console.log(episode.EpisodeNumber); for(var i = 0; i < 5; i++){ data[i+1].push(episode.ratings[i]); } } $('#animeChart').highcharts({ chart: { zoomType: 'x' }, title: { text: animeJSON[selectedSeries][0].anime + ' Episode Ratings' }, scrollbar: { enabled: true }, xAxis: [{ categories: episodes, crosshair: true, min: 0, max: 15 }], yAxis: [{ // Primary yAxis labels: { format: '{value}', style: { color: Highcharts.getOptions().colors[1] } }, title: { text: 'Number of Votes', style: { color: Highcharts.getOptions().colors[1] } } }, { // Secondary yAxis min: 0, max:5, title: { text: 'Score', style: { color: Highcharts.getOptions().colors[0] } }, labels: { format: '{value}', style: { color: Highcharts.getOptions().colors[0] } }, opposite: true }], tooltip: { shared: true }, legend: { layout: 'horizontal', backgroundColor: '#FFFFFF', maxHeight: 50, width: 500, }, series: [{ name: 'Mean Score', type: 'column', yAxis: 1, data: data[0] }, { name: '5', type: 'column', data: data[1], tooltip: { valueSuffix: ' votes' } }, { name: '4', type: 'column', data: data[2], tooltip: { valueSuffix: ' votes' } }, { name: '3', type: 'column', data: data[3], tooltip: { valueSuffix: ' votes' } }, { name: '2', type: 'column', data: data[4], tooltip: { valueSuffix: ' votes' } }, { name: '1', type: 'column', data: data[5], tooltip: { valueSuffix: ' votes' } }] }); }

!