jQuery UI Widgets Forums Chart dynamic names in line chart

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 10 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • dynamic names in line chart #62782

    elbnacht
    Participant

    I’m using the line chart from here:
    demos/jqxchart/javascript_chart_line_series.htm

    Rather having fixed names (‘S&P 500’, ‘NASDAQ’) would I like to use dynamic names (name 1 … 5) coming from my data source.
    The data source is a JSON source and looks like
    [{"dataName":"CEWE","xData":"2014-04-29","yData":"98.99"},{"dataName":"CEWE","xData":"2014-04-22","yData":"97.33"},{"dataName":"CEWE","xData":"2014-04-15","yData":"98.64"},{"dataName":"Drillisch","xData":"2014-02-04","yData":"93.65"},{"dataName":"Drillisch","xData":"2014-01-28","yData":"94.47"},{"dataName":"Drillisch","xData":"2014-01-21","yData":"95.36"},{"dataName":"Drillisch","xData":"2014-01-14","yData":"96.43"}, ...

    The names are always different. How can I implement it. xData for the x-axis and data for the y-axis.
    The display text of each line 1 … 5 should be retrieved from the dataName values.

    Jens

    dynamic names in line chart #62840

    Dimitar
    Participant

    Hello Jens,

    In this case, your series settings should be something like this:

    series: [
            { dataField: 'yData', displayText: dataAdapter.records[0].dataName }
        ]

    You would have to make sure the data adapter has been bound to the data by the time you initialize the chart. Thus, make sure the data adapter’s autoBind option is set to true.

    Best Regards,
    Dimitar

    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.