389
Views
3
Comments
[HighChartsComponent] Ajax Refresh on Highcharts
Question
highchartscomponent
Web icon
Forge asset by The 2 J's

Hey guys, really like this plug in. I have a small problem though, was thinking if someone could help me.

I am using Highcharts component for plotting data from a consumed API. The user can choose dimensions and measures in real time and therefore the component has to be ajax refreshed when the user changes the input. When I tried this with the simple script-component the chart just disappeared when the refresh came and I wonder if this has something to do with the javascript or if I am implementing it wrongly.

I changed to using the Web Block and it worked better however I am plotting things that are dependent of categories, which means I would like to have text instead of numbers in one of the axis, is this possible with the web block? 

Many thanks in advance!

2020-11-10 23-58-16
Raphael Ranieri
 
MVP

Hey Jack,

I had this problem when not setting the min height for the chart.

However is possible to use text as the value of the axis.
You have checked the documentation?

https://www.highcharts.com/docs

UserImage.jpg
Jack Ahlkvist

Raphael Ranieri wrote:

Hey Jack,

I had this problem when not setting the min height for the chart.

However is possible to use text as the value of the axis.
You have checked the documentation?

https://www.highcharts.com/docs

I tried to set the height of the component to an arbitrary number but it still disappeared when I use Ajax refresh, here is my code with hard coded data:

SyntaxEditor Code Snippet

"$(function () {
    $('#" + container.Id +"').highcharts({
        chart: {
            type: 'line',
            zoomType: 'xy',
            height: 500,
            width: 600
        },
        title: {
            text: 'Create PDP Failure'
        },
        subtitle: {
            text: 'time'
        },
        series: [{
            name: 'Users',
            data: [[233,444][444,222]]
      }]
    });
});
"


As I am interpreting the documentation I have to set the xAxis type to categories for the labels to show the strings, (which is not possible through the input variables of the web block) but I haven't read it all. Would mean a lot if you can educate me on how to get the HighChart Web block to do so..

Thanks again for your time! 

UserImage.jpg
Jack Ahlkvist

Oh that's interesting! Thanks for your help! :)

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.