Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textbox input to barchart filter #383

Closed
akila-indrakumar opened this issue Oct 31, 2013 · 3 comments
Closed

textbox input to barchart filter #383

akila-indrakumar opened this issue Oct 31, 2013 · 3 comments
Labels

Comments

@akila-indrakumar
Copy link

hi,
i has did for barchart value to textbox, as same
i need textbox input to barchart value change and the code i tried out is below
please help me out

 for (var x = 0; x < data.length; x++) {
        if (data[x].type == "slider") {

            var facts = crossfilter(data[x]);
            volumeChart[data[x].uniqueid] = dc.lineChart('#chart' + data[x].uniqueid);
            chartsdim = facts.dimension(function (d) {
                return d.maxval;
            });
            var chdimgroup = chartsdim.group();
            volumeChart[data[x].uniqueid].width(500)
     .height(40)

     .margins({ top: 0, right: 50, bottom: 20, left: 40 })
     .dimension(chartsdim)
     .group(chdimgroup)
     //.centerBar(true)
   //  .gap(10)

     .valueAccessor(function (d) {
         return d.maxval;
     })
     .x(d3.scale.linear().domain([data[x].minval, data[x].maxval]))
            //.render([3, 20])
      //.filter([data[x].minval, data[x].maxval])
     .elasticX(false)
      .round(dc.round.floor)

            //  .y(d3.scale.linear().domain([0, 1]))
     .brushOn(true);
            // .yAxis().ticks(2).tickValues([0,10]);
            dc.renderAll();
        }
    }
    dc.renderlet(function () {
        for (var x = 0; x <= data.length; x++) {
                    if (volumeChart[data[x].uniqueid].filter()) {
                        console.log(volumeChart[data[x].uniqueid].filter());
                        var fildata = volumeChart[data[x].uniqueid].filter();
                        console.log("minvalue" + fildata[0] + "  maxvalue" + fildata[1]);
                        $('#min' + data[x].uniqueid).val(Math.round(fildata[0]));
                        $("#max" + data[x].uniqueid).val(Math.round(fildata[1]));
            }
        }
    });

$('#min1').change(function () {
var min = $('#min1').val() + "," + $('#max1').val();
dc.events.trigger(function () {
chartsdim.filter([10, 20]);
});
});

@jrideout
Copy link
Contributor

@akila-indrakumar Can you please restate your problem. I'm not sure what you are asking.

@sclevine
Copy link
Member

This is 4 months old, so I'm closing this. If your question still hasn't been answered, feel free to send it to the mailing list.

@gordonwoodhull
Copy link
Contributor

This was implemented by @tttp in #936, updated by @kum-deepak in #1387, and released in dc.js 3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants