Yup one more thing, the semi-colon in your code here should be removed; it marks the end of code whereas in the next line, .text is being called. tooltip.transition().duration(200).style('opacity', 0.9);<----
ok, I can see the word “test” but the whole thing is not behaving like a "normal tooltip. I am expecting to have the tooltip box appearing when i hove the bar and disappearing when i mouseout
I get this effect using the “title way” but for some reason i cannot pass the test
thank you very much
and sorry for my late reply as I was working on the following project and with your tip i can try to fix my code and pass the tests, even though there is something else that is not working but honestly I do not understand the requirement… may I ask to you?
Sure, please feel free to post your queries here. I’ve recently completed this project, so hopefully I should be able to help. Even otherwise this forum is quite helpful and somebody would definitely guide you.
If you click on the red button on tests failed, it will display the tests executed and the error messages.
The error message says:
The bar elements’ “data-date” properties should match the order of the provided data.
Bars should have date data in the same order as the provided data : expected ‘Sat Feb 01 1947 00:00:00 GMT+0000 (Greenwich Mean Time)’ to equal ‘1947-01-01’
There are 2 problems here:
The format - your rect shape’s data-date attribute value is in date format whereas expected is a string:
The values in the original array dataArr was changed in date format. You can use d3.timeFormat to store this date into a string in the data-date attribute.
Also, the tooltip 's attr (data-date) has the same format error. It needs the same fix.
Notice the month - in the date format, it says Feb whereas in the string,the month is equal to ‘01’.
so, Jan is 0, Feb is 1. When the string is converted to date, ‘1947-01-01’ is changed to Feb 1947 instead of Jan 1947.
You could subtract the month by 1 in your code dataArr.forEach(…) to fix this.
ok, that’s weird and embarassing.
Before replying to you, yesterday, I had 2 errors (regarding "dispatching event) whereas you the wrote you had only one, related to the data-date attibute.
Then I soon changed accordingly to what you wrote (which made sense to me) but something got wrong and I got TWELVE errors.
I commented out the tooltip events , reran the test and I went back to only 2 errors.
I uncommented the tooltip part, again 2 errors only, which are those belows