<commit_before>$ = window.$
misc = require('smc-util/misc')
{defaults, required} = misc

# load the npm install'd d3;  NOTE!: just doing require('d3') itself fails with webpack.
# earlier, there was a d3/d3.js file, but after the latest major update, there is a minified version available
d3 = require('d3/build/d3.min.js')

# Make d3 available to users in general.
window?.d3 = d3

$.fn.extend
    d3: (opts={}) ->
        opts = defaults opts,
            viewer : required
            data   : required
        @each () ->
            t = $(this)
            elt = $("<div>")
            t.replaceWith(elt)
            switch opts.viewer
                when 'graph'
                    d3_graph(elt, opts.data)<commit_msg>Simply import D3<commit_after>$ = window.$
misc = require('smc-util/misc')
{defaults, required} = misc

d3 = require('d3')

# Make d3 available to users in general.
window?.d3 = d3

$.fn.extend
    d3: (opts={}) ->
        opts = defaults opts,
            viewer : required
            data   : required
        @each () ->
            t = $(this)
            elt = $("<div>")
            t.replaceWith(elt)
            switch opts.viewer
                when 'graph'
                    d3_graph(elt, opts.data)
{'fraction_non_alphanumeric': 0.129136400322841, 'fraction_numerical': 0.016142050040355124, 'mean_word_length': 1.8181818181818181, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6936999', 'n_tokens_mistral': 391, 'n_tokens_neox': 375, 'n_words': 112}