Probably this is a silly question since I’m starting with toolkit now, but it’s driving me crazy. I’m trying to display a visual (a simple bars), but I keep getting this error:
A provider is required
I’m using an Elasticsearch server in my local and I included the cft-elasticsearch-provider.min.js library in my app too. So honestly don’t know what is going on. This is the code for my visualization:
Your query is correct except for one thing which btw is not related with your issue: You are missing the .element('div-id') so you can actually render a Bars within that div-id element.
Now, regarding to the actual issue, did you register your provider before executing your visuals? I mean this:
cf.setProviders(providers)
Remember that providers should be an array of JSON configs.
Sorry for the late response, I find out what was happening. Yes of course I was using the cf.setProviders() with the configuration, but my configuration was using as the name of the provider: “elasticsearch” instead of “Elasticsearch” which is the one that I’m using in the visualization. As soon as I changed them, it worked!
It happened to me in the past as well and several times, and it gets a little more complicated when you have a lot of visualizations. So, what I usually do is to declare a variable with the name of the provider and the name of the source that I’ll use across all of my visualizations, so that way I avoid miss-typing names.