jQuery UI Widgets Forums Chart Help possibility to do that

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 6 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Help possibility to do that #100491

    nico86
    Participant

    Hi,
    I managed to make this graph
    Mon image

    with a litle database like this one…
    Mon image

    and the associated program

               var source =
                {
                    datatype: "json",
                    datafields: [
                        { name: 'TRTSTARTDATC' },
                        { name: 'INDEX1' },
                        { name: 'INDEX2' }
    				
                    ],
                    localdata: resu
                };
    
                var dataAdapter = new $.jqx.dataAdapter(source);
    			var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
                var settings = {
                    title: "Line serie with missing points",
                    description: 'Sample line serie with missing and invalid values',
                    showLegend: true,
                    enableAnimations: true,
                    padding: { left: 5, top: 1, right: 15, bottom: 5 },
                    titlePadding: { left: 0, top: 0, right: 0, bottom: 10 },
                    source: dataAdapter,
                    xAxis:
                    {
                    	dataField: 'TRTSTARTDATC',
                        formatFunction: function (value) {
                            return value.getDate() + '-' + months[value.getMonth()] + '-' + value.getFullYear();
                        },
                        type: 'date',
                        baseUnit: 'month',
                        valuesOnTicks: true,
                        minValue: '01-01-2014',
                        maxValue: '01-06-2018',
    
                    },
                    valueAxis:
                    {
                        unitInterval: 1,
                        minValue: 0,
                        maxValue: 30,
                        labels: {horizontalAlignment: 'right'},
                        title: { text: 'MEDICNB' }
                    },
                    colorScheme: 'scheme05',
                    seriesGroups:
                        [
                            {
                                type: 'line',
                                series:
                                    [
                                        { dataField: 'INDEX1', emptyPointsDisplay: 'skip', displayText: 'AAA', lineWidth: 2, symbolSize: 8, symbolType: 'circle' }
                                        
                                    ]
    
                            },
     						{				
                                type: 'line',
                                series: [
                                        { dataField: 'INDEX2', emptyPointsDisplay: 'skip', displayText: 'BBB', lineWidth: 2, symbolSize: 8, symbolType: 'circle' }
                                ]
                            }                   
    
                        ]
                };
                // create the chart
                $("#output").jqxChart(settings);

    But this forcedme to create a series by drug(MEDICNB variable) that I have in my base… I would like that every addition of data in my base (new drug) The graph adds the new line without having to modify the code… Is that possible? Is there a way to present the database or program the JS to achieve this task?

    Thanks
    Nicolas;

    Help possibility to do that #100503

    Hristo
    Participant

    Hello Nicolas,

    I would like to suggest you look at this forum topic, there has a similar discussion:
    https://www.jqwidgets.com/community/topic/changing-data-series/#post-28299
    You could use this approach to add new series in your scenario.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.