How to use the dc.barChart function in dc

To help you get started, we’ve selected a few dc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NLeSC / spot / client / views / barchart.js View on Github external
var y = parseInt(x);

        // dont do anything without a facet defined
        if(! this.model.primary) {
            return;
        }
        if(! this.model._crossfilter) {
            this.model.initFilter();
        }

        // tear down existing stuff
        delete this._chart;

        // Options:
        // mouseZoomable : does not work well in comibination when using a trackpad
        var chart = dc.barChart(this.queryByHook('barchart'));
        var that = this; // used in callback
        chart
            .outerPadding(1.0)
            .brushOn(true)
            .mouseZoomable(false)
            .elasticX(false)
            .elasticY(true)

            .xUnits(this.model.primary.xUnits)
            .x(this.model.primary.x)

            .transitionDuration(app.me.anim_speed);

        // Stacked barchart
        if(this.model.secondary && this.model.secondary.displayCategorial) {
github h12345jack / bilibili-Visualization / src / components / visualize.js View on Github external
export function visualize (csv_data) {

    let danmu_lineChart = dc.lineChart('#danmu-line-chart');
    let danmu_barChart = dc.barChart('#danmu-volume-chart');

    let colorChart = dc.pieChart('#color-chart');
    let posChart = dc.pieChart('#pos-chart');
    let charNumChart = dc.pieChart('#char-chart');


    let danmu_up_barChart = dc.barChart('#danmu-up-chart');

    let data = [];

            /* 修改开始出*/
    //图表宽度
    let row_width = 500;

    //弹幕时间 分割
    let time_cut = 100;
    //上传时间的分割
    let up_time_cut = 100;
    //字数分割
    let char_num_cut = 5;

    let video_length = parseFloat(csv_data[1].video_len);
    let video_up_time = new Date($("time").attr("datetime"));
github apinf / platform / apinf_packages / dashboard / client / charts / charts.js View on Github external
timeStampGroup,
      statusCodeDimension,
      statusCodeGroup,
      responseTimeDimension,
      responseTimeGroup,
      timeScaleForLineChart,
      timeScaleForRangeChart,
      xScaleForBar,
      binwidth,
    } = parsedData;

    // Init charts
    const requestsOverTime = dc.lineChart('#requestsOverTime-chart');
    const overviewChart = dc.barChart('#overviewChart-chart');
    const statusCodeCounts = dc.rowChart('#statusCodeCounts-chart');
    const responseTimeDistribution = dc.barChart('#responseTimeDistribution-chart');

    requestsOverTime
      .height(350)
      .renderArea(true)
      .transitionDuration(300)
      .margins({ top: 5, right: 20, bottom: 25, left: 40 })
      .ordinalColors(['#2fa4e7'])
      .x(timeScaleForLineChart)
      .dimension(timeStampDimension)
      .group(timeStampGroup)
      .rangeChart(overviewChart)
      .brushOn(false)
      .renderHorizontalGridLines(true)
      .renderVerticalGridLines(true)
      .elasticY(true);
github mitmedialab / MediaCloud-Web-Tools / src / components / topic / stories / InfluentialStoryExplorer.js View on Github external
renderDC = (selectedTimespan) => {
    const { formatMessage } = this.props.intl;
    // show a spinner while it loads
    this.showLoading(true);
    // set up chart containers
    const storiesOverTimeChart = dc.barChart('#stories-over-time-chart');
    const storyCount = dc.dataCount('#story-counts');
    const languageChart = dc.pieChart('#language-chart');
    const TopicStoryTable = dc.dataTable('#story-table');
    const facebookShareChart = dc.barChart('#facebook-share-chart');
    const inlinkChart = dc.barChart('#inlink-chart');
    // load the data up
    d3.csv(this.csvFileUrl(), (data) => {
      this.showLoading(false);
      // set up some binning
      const maxFacebookShares = d3.max(data.map(d => d.facebook_share_count));
      const facebookBinSize = maxFacebookShares / FACEBOOK_BIN_COUNT;
      const maxInlinks = d3.max(data.map(d => d.media_inlink_count));
      const inlinkBinSize = d3.max([1, (maxInlinks / INLINK_BIN_COUNT)]); // don't do < 1 for bin size
      // clean up the data
      for (let i = 0; i < data.length; i += 1) {
        const d = data[i];
        d.publishDate = (d.publish_date === STORY_PUB_DATE_UNDATEABLE) ? null : storyPubDateToMoment(d.publish_date).toDate();
        d.publishMonth = (d.publish_date === STORY_PUB_DATE_UNDATEABLE) ? null : d.publishDate.getMonth(); // pre-calculate month for better performance
        d.facebook_share_count = +d.facebook_share_count;
        d.inlink_count = +d.inlink_count;
github NSWSESMembers / Lighthouse / pages / scripts / stats.js View on Github external
facts = crossfilter(jobs.Results)

    var all = facts.groupAll();

    //display totals
    countchart = dc.dataCount(".total");

    // jobs per hour time chart
    timeOpenChart = dc.barChart("#dc-timeopen-chart");
    runningChart = dc.compositeChart("#dc-running-chart");

    timeClosedChart = dc.barChart("#dc-timeclosed-chart");
    dataTable = dc.dataTable("#dc-table-graph");


    completionBellChart = dc.barChart("#dc-completionbell-chart");

    var closeTimeDimension = facts.dimension(function(d) {
      return d.JobCompleted;
    });

    var timeOpenDimension = facts.dimension(function(d) {
      return d.JobReceivedFixed;
    });


    var oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
    var timeDifference = (Math.round(Math.abs((start.getTime() - end.getTime()) / (oneDay))));
    var timePeriodWord;
    var timePeriodUnits;

    if (timeDifference <= 14) {
github apinf / platform / apinf_packages / dashboard / client / charts / charts.js View on Github external
const {
      timeStampDimension,
      timeStampGroup,
      statusCodeDimension,
      statusCodeGroup,
      responseTimeDimension,
      responseTimeGroup,
      timeScaleForLineChart,
      timeScaleForRangeChart,
      xScaleForBar,
      binwidth,
    } = parsedData;

    // Init charts
    const requestsOverTime = dc.lineChart('#requestsOverTime-chart');
    const overviewChart = dc.barChart('#overviewChart-chart');
    const statusCodeCounts = dc.rowChart('#statusCodeCounts-chart');
    const responseTimeDistribution = dc.barChart('#responseTimeDistribution-chart');

    requestsOverTime
      .height(350)
      .renderArea(true)
      .transitionDuration(300)
      .margins({ top: 5, right: 20, bottom: 25, left: 40 })
      .ordinalColors(['#2fa4e7'])
      .x(timeScaleForLineChart)
      .dimension(timeStampDimension)
      .group(timeStampGroup)
      .rangeChart(overviewChart)
      .brushOn(false)
      .renderHorizontalGridLines(true)
      .renderVerticalGridLines(true)
github Graylog2 / graylog2-server / javascript / src / components / visualizations / HistogramVisualization.jsx View on Github external
renderHistogram() {
    var histogramDomNode = ReactDOM.findDOMNode(this);

    this.histogram = dc.barChart(histogramDomNode);
    this.histogram
      .width(this.props.width)
      .height(this.props.height)
      .margins({left: 50, right: 15, top: 10, bottom: 30})
      .dimension(this.dimension)
      .group(this.group)
      .x(d3.time.scale())
      .elasticX(true)
      .elasticY(true)
      .centerBar(true)
      .renderHorizontalGridLines(true)
      .brushOn(false)
      .xAxisLabel("Time")
      .yAxisLabel("Messages")
      .renderTitle(false)
      .colors(D3Utils.glColourPalette())
github Graylog2 / graylog2-server / graylog2-web-interface / src / components / visualizations / QuickValuesHistogramVisualization.jsx View on Github external
_renderChart() {
    const { interval, timerange, limit, width, height } = this.state;
    const dimension = this._crossfilter.dimension(d => d3.time[interval](d.key));

    this._chart = dc.barChart(this._chartRef);

    this._chart
      .width(width)
      .height(height)
      .margins(this.CHART_MARGINS.toJS())
      .dimension(dimension)
      .x(d3.time.scale.utc().domain([timerange.from, timerange.to]))
      .elasticX(false)
      .elasticY(true)
      .round(d3.time[interval].utc.round)
      .xUnits(d3.time[interval].utc.range)
      .renderHorizontalGridLines(true)
      .brushOn(false)
      .xAxisLabel('Time')
      .yAxisLabel(this.props.config.field)
      .colors(D3Utils.glColourPalette())
github Graylog2 / graylog2-server / graylog2-web-interface / src / components / visualizations / HistogramVisualization.jsx View on Github external
renderHistogram = () => {
    const histogramDomNode = this._graph;
    const xAxisLabel = this.props.config.xAxis || 'Time';
    const yAxisLabel = this.props.config.yAxis || 'Messages';

    this.histogram = dc.barChart(histogramDomNode);
    this.histogram
      .width(this.props.width)
      .height(this.props.height)
      .margins({ left: 50, right: 15, top: 10, bottom: 30 })
      .dimension(this.dimension)
      .group(this.group)
      .x(d3.time.scale())
      .elasticX(true)
      .elasticY(true)
      .centerBar(true)
      .renderHorizontalGridLines(true)
      .brushOn(false)
      .xAxisLabel(xAxisLabel)
      .yAxisLabel(yAxisLabel)
      .renderTitle(false)
      .colors(D3Utils.glColourPalette());
github Graylog2 / graylog2-server / graylog2-web-interface / src / components / visualizations / GraphVisualization.jsx View on Github external
create(config, domNode, renderTooltip, tooltipTitleFormatter) {
    let graph;
    let tooltipSelector;
    switch (config.renderer) {
      case 'line':
        graph = dc.lineChart(domNode);
        tooltipSelector = '.chart-body circle.dot';
        break;
      case 'area':
        graph = dc.lineChart(domNode);
        graph.renderArea(true);
        tooltipSelector = '.chart-body circle.dot';
        break;
      case 'bar':
        graph = dc.barChart(domNode);
        graph.centerBar(true);
        tooltipSelector = '.chart-body rect.bar';
        break;
      case 'scatterplot':
        graph = dc.lineChart(domNode);
        graph.renderDataPoints({ radius: 2, fillOpacity: 1, strokeOpacity: 1 });
        tooltipSelector = '.chart-body circle.dot';
        break;
      default:
        throw new Error(`Unsupported renderer '${config.renderer}'`);
    }

    if (renderTooltip && tooltipSelector) {
      D3Utils.tooltipRenderlet(graph, tooltipSelector, tooltipTitleFormatter);
    }

dc

A multi-dimensional charting library built to work natively with crossfilter and rendered using d3.js

Apache-2.0
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis