diff --git a/gitinspector/blame.py b/gitinspector/blame.py index 98956c8..d175aed 100644 --- a/gitinspector/blame.py +++ b/gitinspector/blame.py @@ -229,7 +229,7 @@ class BlameOutput(Outputable): blame_xml += "<tfoot><tr> <td colspan=\"5\"> </td> </tr></tfoot></tbody></table>" blame_xml += "<div class=\"chart\" id=\"blame_chart\"></div></div>" blame_xml += "<script type=\"text/javascript\">" - blame_xml += " $.plot($(\"#blame_chart\"), [{0}], {{".format(chart_data) + blame_xml += " blame_plot = $.plot($(\"#blame_chart\"), [{0}], {{".format(chart_data) blame_xml += " series: {" blame_xml += " pie: {" blame_xml += " innerRadius: 0.4," diff --git a/gitinspector/changes.py b/gitinspector/changes.py index 5765cc6..2cfe7f5 100644 --- a/gitinspector/changes.py +++ b/gitinspector/changes.py @@ -241,7 +241,7 @@ class ChangesOutput(Outputable): changes_xml += ("<tfoot><tr> <td colspan=\"5\"> </td> </tr></tfoot></tbody></table>") changes_xml += "<div class=\"chart\" id=\"changes_chart\"></div></div>" changes_xml += "<script type=\"text/javascript\">" - changes_xml += " $.plot($(\"#changes_chart\"), [{0}], {{".format(chart_data) + changes_xml += " changes_plot = $.plot($(\"#changes_chart\"), [{0}], {{".format(chart_data) changes_xml += " series: {" changes_xml += " pie: {" changes_xml += " innerRadius: 0.4," diff --git a/gitinspector/html/html.header b/gitinspector/html/html.header index c2559f9..6036998 100644 --- a/gitinspector/html/html.header +++ b/gitinspector/html/html.header @@ -142,6 +142,21 @@ this.hoveredElement.removeClass("piehover"); }} }}); + + // Make sure the two pie charts use the same colors. + + var author_colors = {{}}; + $.each(changes_plot.getData(), function(i, v) {{ + author_colors[v["label"]] = v["color"]; + }}); + + $.each(blame_plot.getData(), function(i, v) {{ + if (author_colors[v["label"]] != undefined) {{ + v["color"] = author_colors[v["label"]]; + }} + }}); + + blame_plot.draw(); }}); </script> <style type="text/css">