logo
down
shadow

How to I find the original row index of a table in a google visualization if I have a filtered rows view


How to I find the original row index of a table in a google visualization if I have a filtered rows view

By : Kim Shepherd
Date : November 22 2020, 03:01 PM
may help you . getTableRowIndex is a DataView method
on your chart wrapper, if you set the dataTable property to a data view,
code :
chartWrapper.getDataTable().getTableRowIndex(currentRow)
chartWrapper.getView().rows[currentRow]
google.charts.load('current', {
  packages: ['controls']
}).then(function () {
  var data = google.visualization.arrayToDataTable([
    ['Year', 'Sales', 'Expenses', 'Profit'],
    ['2012', 900, 700, 200],
    ['2013', 890, 600, 290],
    ['2014', 1000, 400, 200],
    ['2015', 1170, 460, 250],
    ['2016', 660, 1120, 300],
    ['2017', 1030, 540, 350]
  ]);

  var chartTable = new google.visualization.ChartWrapper({
    chartType: 'Table',
    containerId: 'chart_div',
    dataTable: data,
    view: {
      rows: data.getFilteredRows([{
        column: 1,
        minValue: 1000
      }])
    }
  });

  var testDiv = document.getElementById('test_div');
  google.visualization.events.addOneTimeListener(chartTable, 'ready', function () {
    google.visualization.events.addListener(chartTable.getChart(), 'select', function () {
      testDiv.innerHTML = '';
      var selection = chartTable.getChart().getSelection();
      for (var i = 0; i < selection.length; i++) {
        var selectedRow = selection[i].row;
        var dataTableRow = chartTable.getView().rows[selectedRow];
        var values = '';
        for (var col = 0; col < data.getNumberOfColumns(); col++) {
          if (values !== '') {
            values += ' -- ';
          }
          values += data.getValue(dataTableRow, col);
        }
        values += '<br/>';
        testDiv.insertAdjacentHTML('beforeEnd', values);
      }
    });
  });

  chartTable.draw();
});
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>
<div id="test_div"></div>


Share : facebook icon twitter icon
Google Visualization: Create Data View from Filtered Table

Google Visualization: Create Data View from Filtered Table


By : Shubhendu
Date : March 29 2020, 07:55 AM
I wish did fix the issue. For the benefit of anyone who might find this useful, here is the how I solved my problem:
First, create an array of control states from dashboard
code :
control_states = [ctrl1.getState(),ctrl2.getState(),ctrl3.getState()];
var filteredrows = [ ];
var cnt = 0;
for (var i = 0; i < control_states.length; i++) {
  var picker_state = control_states[i]
  for (var j = 0; j < picker_state.selectedValues.length; j++) {
    filteredrows[cnt] = [ ];
    filteredrows[cnt]["column"] = i;
    filteredrows[cnt]["value"] = picker_state.selectedValues[j];
    cnt += 1;
  };
};
var filterdata = new google.visualization.DataView(data)
filterdata.setRows(
  filterdata.getFilteredRows(filteredrows)
);
AngularJS: find the index position of filtered value in the original array

AngularJS: find the index position of filtered value in the original array


By : Pradeep Bharamagoudr
Date : March 29 2020, 07:55 AM
I wish this helpful for you ,
find the index position of filtered value in the original array
code :
<div ng-repeat="person in data | filter: {id:20}">
    {{data.indexOf(person)}}
</div>
Google Charts: How to replace data table elements in visualization, but not in original table (DataView approach not wor

Google Charts: How to replace data table elements in visualization, but not in original table (DataView approach not wor


By : Shima Hamad
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I suspect that you have two problems in your code. The first is that when you added the "Gender" column to the DataView, you left off the column label, which is needed because your gender filter has the filterColumnLabel option set instead of filterColumnIndex. Add the label in to fix:
code :
{calc: sexfix, type:'string', label: 'Gender'}
new google.visualization.Dashboard(document.getElementById('dashboard')).
// Establish bindings, declaring the both the slider and the category
// picker will drive both charts.
bind([slider, categoryPicker], [pie, table]).
// Draw the entire dashboard.
draw(dview);
Google Visualization : How do I perform check/uncheck with google visualization table associated checkbox?

Google Visualization : How do I perform check/uncheck with google visualization table associated checkbox?


By : zzzzzzzzzzzzzz
Date : March 29 2020, 07:55 AM
seems to work fine Finally, I developed a solution for this. Here it is. First, draw the table using google visualization API then draw the checkbox using HTML dom.
code :
function handleQuestionsSqlQueryResponse(dataQueryQuestionsResponse) {
            if (dataQueryQuestionsResponse.isError()) {
                alert('Error in query: ' + dataQueryQuestionsResponse.getMessage() + ' ' + dataQueryQuestionsResponse.getDetailedMessage());
                return;
            }
            var dtQuestions = dataQueryQuestionsResponse.getDataTable();
            var intNoOfRows = dtQuestions.getNumberOfRows();
            for (intRowCounter = 0; intRowCounter < intNoOfRows ; intRowCounter++) {
                var tblQuestions = new google.visualization.DataTable();
                tblQuestions.addColumn('string', '');
                tblQuestions.addColumn('string', '');
                var arrQuestions = new Array();
                var strQuestionSection = dtQuestions.getValue(intRowCounter, 0);
                var strQuestionDetails = dtQuestions.getValue(intRowCounter, 1);
                if (strQuestionSection !== null && strQuestionDetails !== null) {
                    arrQuestions = strQuestionDetails.split(";");
                    for (var intRowIterator = 0; intRowIterator < arrQuestions.length; intRowIterator++) {
                        var intCount = 0 * 1;
                        var tblQuestionsRow = new Array();
                        var strQuestionNo = arrQuestions[intRowIterator].split("|")[0];
                        var strQuestionName = arrQuestions[intRowIterator].split("|")[1];
                        tblQuestionsRow[intCount++] = strQuestionName;
                        if (strQuestionName === "Other / Unknown? Please Describe:") {
                            tblQuestionsRow[intCount++] = "<input type=\"text\"" + "size=\"30\" id=\"" + strQuestionNo + "Others" + "\"" + " value='' name='" + strQuestionNo + "' disabled />";
                        } else {
                            tblQuestionsRow[intCount++] = null;
                        }
                        tblQuestions.addRow(tblQuestionsRow);
                    }
                    var tableObject = new google.visualization.Table(document.getElementById(strQuestionSection));
                    tableObject.draw(tblQuestions, { allowHtml: true, 'cssClassNames': cssClasses, width: '100%', sort: 'disable' });
                }
            }
            for (intRowCounter = 0; intRowCounter < intNoOfRows ; intRowCounter++) {
                var intQuestionValue = 0;
                var strQuestionSection = dtQuestions.getValue(intRowCounter, 0);
                var strQuestionDetails = dtQuestions.getValue(intRowCounter, 1);
                var tblContainer = document.getElementById(strQuestionSection);
                var tblReference = tblContainer.getElementsByTagName('TBODY')[0];
                arrQuestions = strQuestionDetails.split(";");
                for (var intRowIterator = 0; intRowIterator < arrQuestions.length; intRowIterator++) {
                    var tblRow = tblReference.rows[intRowIterator];
                    var tblCheckBox = tblRow.insertCell(0);
                    var strQuestionNo = arrQuestions[intRowIterator].split("|")[0];
                    if (strQuestionNo !== null) {
                        tblCheckBox.innerHTML = "<input type=\"checkbox\"" + " id=\"" + strQuestionNo + "\" name=\"" + strQuestionNo + "\" value=\"" +
                                                        intQuestionValue + "\" onchange=\"doCheckOrUnCheck('" + strQuestionNo + "');\" />";
                    }
                }
            }

        }
Adding rows to the Google Data Visualization Table

Adding rows to the Google Data Visualization Table


By : Babak Mojdehifar
Date : March 29 2020, 07:55 AM
like below fixes the issue It looks like you are rebuilding the data structure each time you iterate. It happens that your headers are the same. But in this case the whole data gets re-written on each iteration. Perhaps try something like this.
code :
    $.ajax({
      type: 'GET',
      url: '/api/v1.0/tasks/'+document.getElementById("autocomplete").value,
      dataType: 'json',
      data: { 'value' : $(this).val() },
      success : function(data){


      var datag = new google.visualization.DataTable();
          datag.addColumn('number', 'lat');
          datag.addColumn('number', 'longi');
          datag.addColumn('string', 'markerstr');
      var rows = []
      for(var i=0; i<data.task.length; i++) {

         var lat,long,name;
         var lat = data.task[i].lat
         var longi = data.task[i].longi
         var name = data.task[i].markerText
         rows.push([lat,longi,name]);
    }
      datag.addRows(rows);
 })
Related Posts Related Posts :
  • Is it possible to animate a ViewCell when it appears or disappears?
  • How to install cocoa pods
  • rxjs created observable timeout always errors
  • adding lines without overwriting existing
  • How to setup Microsoft LUIS to detect composed names (dash separated)
  • In Ektron, Load Last Active Location
  • In Cypress how to count a selection of items and get the length?
  • Openlayers rotation broken when using precompose to clip a layer
  • Using SendGrid package with C# "Web" as shown in examples, is undefined
  • Service Worker: files are updated on the server but old version showing in browser
  • Ignore empty form values on update using laravl5
  • Expect: How to get the exit code from spawned process
  • Using In clause in apache Camel
  • Pass qualifier to provider method
  • Disable retained MQTT messages in Rabbit MQ
  • How to escape mask rules in kendo maskedtextbox for angular2?
  • How to delete blank rows in spss modeler
  • modify content of http response via haproxy
  • PUT multiple related records in Data API request
  • Getting data (text, ...) what user says
  • Transforming a list of structs with parent IDs into a list of trees
  • Eloquent relationship returns null, but a similar one is fine
  • how can i find the exact tick in netlogo in which agents take an action?
  • await - catch error - UnhandledPromiseRejectionWarning
  • Understanding Fabric Daily Summary Email
  • How to pass string and file as input for form parameters in a POST method using Karate
  • Windows app: fatal error C1083: Cannot open include file: 'gdiplus.h': No such file or directory
  • I have a list and I want to print a range of it's content with range and for loop
  • Integration Testing with Kitchen CI
  • Can't seem to get the from <asp:Literal </asp:Literal> property in Web forms
  • Can't access faraday params on views
  • RQM testNG integration
  • How can I enable unit templates?
  • Displaying multiple colors on a single data bar
  • Loading aggregates on reacting to domain events
  • Integrating Azure Cognitive services with Robotic Process Automation
  • Autodesk Forge Design Automation quota
  • Why can i not login to the wso2 api store using the email address of a secondary user store account
  • order not working with sortWhitelist
  • config.site for vendor libs on Fedora x86_64
  • Getting a limit response from Loopback, when no authentication is provided
  • What is the effect of FeedOptions.EnableLowPrecisionOrderBy Property
  • Recordset Null Value not being detected in null check
  • How to connect to an arbitary database using FaaS?
  • SourceTree not working after Windows 10 Fall Creators Update
  • How to get all registered user from Openfire through http
  • Error "invalid parameter" when launching a converted app
  • Using react-sortable-hoc with react-virtualized Grid
  • Xamarin.Forms: How to set values in Style only on specific platform
  • ZSH avoid adding empty commands to history?
  • Grep regular expression - Pattern issue
  • Unable to connect via Java to a DSE graph
  • Check if attachment is up to date with current document revision in couchdb
  • Can I bind an argument value ahead of time when using redux-actions?
  • How to change a member field with Kotlin reflection?
  • Replaying merged streams individually
  • DevExpress GridColumn strange proportional sizing
  • Drools Decision table error : Error while creating KieBase
  • Kafka-Flink-Stream processing: Is there a way to reload input files into the variables being used in a streaming process
  • How to export and import nifi flow from one HDP to another HDP
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org