MOKSHA SHAH Posted March 19, 2021 Share Posted March 19, 2021 Hi Team I am trying to establishthe bar gragh with JS viz in spotfire. I took the data fromhttps://community.spotfire.com/wiki/tibco-spotfire-survey-data-chart-using-... . In my case data is not popullating in the graph. I went through all dr. spotfire videos and documentation but could not ableto troubleshoot. Even though my code is not throwingany error. Herewith I am attaching code snipet and screenshot(Image 1, Image 2). Kindly help with my code(bar.js). I have attached the following files from this link:https://community.spotfire.com/wiki/tibco-spotfire-survey-data-chart-using-... jQuery.js Template.css JSViz.js Link to comment Share on other sites More sharing options...
MOKSHA SHAH Posted March 27, 2021 Author Share Posted March 27, 2021 Hi Team I have debugg the issue and it is related to the missing actionof data rows being passed. The snippet which I have attached (bar.js) inside it, add the following linesin function renderCore(sfdata): for ( var nIndex = 0 ; nIndex < chartdata.length ; nIndex++ ) { var items = chartdata[nIndex].items; var barrow= items; barrow.Question = items[0]; barrow.value= items[1]; //var pollrow = items; bardata.push(barrow); } the above loop helps us to readeach row and push the data into the array. Link to comment Share on other sites More sharing options...
MOKSHA SHAH Posted March 29, 2021 Author Share Posted March 29, 2021 MARKING ISSUE Hi All Now I am facing marking issue in theviz.I want a single visualisation on every marking, but in my case multiple visualisation is apperaing when I change marking. Following are the obervation I noted while enabling marking: 1. My Script(bar.js) is running absouletly fine with no error. When I marked all the rows.(Image_3) 2. When I markany particularrow, the marking is working, but for everymarking new graph is appreaing.(Image_4). There is a part of Image_3 present in Image_ 4 which shows that, there is not a single visualisation, instead there are both old and new marked data present. And this sequence continues everytime I click on any row. 3.When I switch to new tab and come back to orginal, then all other graphs disappear and only marking one remains.(Image_5). Kindly please help. Link to comment Share on other sites More sharing options...
MOKSHA SHAH Posted April 10, 2021 Author Share Posted April 10, 2021 Regarding this marking issue, I was not removing the exiting SVG whenever the draw function is being called. So I simply added the empty element in the fuction just before setting the svg. There are two methods to pass it: 1. $("js-chart").empty(); OR 2. d3.select("#d3-plot").remove (); svg = d3.select("#js_chart").append("svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) . attr("id", "d3-plot") cheers!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now