<commit_before>import React, {Component} from 'react'
var ReactFauxDOM = require('react-faux-dom')
import {ROOT_PATH} from '../constants'
import {barChartGenerator} from '../utils/chartGenerators.js'
var d3_save_svg = require('d3-save-svg');
var d3 = require('d3')


export default class DashboardCard extends Component{
  constructor(props){
    super(props)
    console.log("props are...", props)
  }
  componentDidMount(){
  }

  exportAsSVG() {
    d3_save_svg.save(d3.select('svg').node(), config);
  };
  
  render(){
    console.log("props in DashboardCard are ", this.props)
    let title = this.props.card.title || 'Delightful Chart Example'
    let userCode = this.props.userCode || undefined
    let chart = this.props.card.chart || barChartGenerator
    console.log("Chart is ", chart)
    return(
      <div className="x_panel tile fixed_height_320">
        <div className="x_title">
          <h2>{title}</h2>
          <ul className="nav navbar-right panel_toolbox">
            <li><a className="collapse-link"><i className="fa fa-chevron-up"></i></a>
            </li>
            <li className="dropdown">
              <a href="#" className="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i className="fa fa-wrench"></i></a>
              <ul className="dropdown-menu" role="menu">
                <li><a href="#">Settings 1</a>
                </li>
                <li><a href="#">Settings 2</a>
                </li>
              </ul>
            </li>
            <li><a className="close-link"><i className="fa fa-close"></i></a>
            </li>
          </ul>
          <div className="clearfix"></div>
        </div><commit_msg>export chart as SVG using chart's title as the filename<commit_after>import React, {Component} from 'react'
var ReactFauxDOM = require('react-faux-dom')
import {ROOT_PATH} from '../constants'
import {barChartGenerator} from '../utils/chartGenerators.js'
var d3_save_svg = require('d3-save-svg');
var d3 = require('d3')


export default class DashboardCard extends Component{
  constructor(props){
    super(props)
    this.title= props.card.title
    this.exportAsSVG = this.exportAsSVG.bind(this);

  }
  componentDidMount(){
  }

  exportAsSVG() {
    var config = {
      filename: this.title
    }
    d3_save_svg.save(d3.select('svg').node(), config);
  }
  
  render(){
    let title = this.props.card.title || 'Delightful Chart Example'
    let userCode = this.props.userCode || undefined
    let chart = this.props.card.chart || barChartGenerator
    return(
      <div className="x_panel tile fixed_height_320">
        <div className="x_title">
          <h2>{title}</h2>
          <ul className="nav navbar-right panel_toolbox">
            <li><a className="collapse-link"><i className="fa fa-chevron-up"></i></a>
            </li>
            <li className="dropdown">
              <a href="#" className="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i className="fa fa-wrench"></i></a>
              <ul className="dropdown-menu" role="menu">
                <li><a href="#">Settings 1</a>
                </li>
                <li><a href="#">Settings 2</a>
                </li>
              </ul>
            </li>
            <li><a className="close-link"><i className="fa fa-close"></i></a>
            </li>
          </ul>
          <div className="clearfix"></div>
        </div>
{'fraction_non_alphanumeric': 0.16359918200409, 'fraction_numerical': 0.007595676307332749, 'mean_word_length': 2.5081967213114753, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 0, '>': 77, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3929443', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1027, 'n_words': 223}