docs: def _create_matrix_chart(self, data, works, output_dir):
          """Generates and writes to a file in `output_dir` the data used to
          display a matrix chart.
  
          :param data: data to derive the matrix data from
          :type data: `pandas.DataFrame`
          :param works: works to display
          :type works: `list`
          :param output_dir: directory to output data file to
          :type output_dir: `str`
  
          """
          nodes = [{'work': work, 'group': 1} for work in works]
          weights = data.stack().unstack(RELATED_WORK).max()
          seen = []
          links = []
          for (source, target), weight in weights.iteritems():
              if target not in seen and target != source:
                  seen.append(source)
                  links.append({'source': works.index(source),
                                'target': works.index(target),
                                'value': weight})
          json_data = json.dumps({'nodes': nodes, 'links': links})
          with open(os.path.join(output_dir, 'matrix_data.js'), 'w') as fh:
              fh.write('var matrixData = {}'.format(json_data))