jQuery UI Widgets Forums Chart How to assign Values to DisplayText in Chart Serires

This topic contains 3 replies, has 2 voices, and was last updated by  Dimitar 11 years, 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • leopini
    Member

    Hi,

    I am trying to set values to ‘DisplayText’ on series parameter in a chart, because we need to show labels according to value from database. I mean we don’t want to set a string but a variable string from a field from the database. These fields already are set on ‘datafields’ parameter:
    datafields: [
    { name: ‘Date_Reading’ },
    { name: ‘Id_Reading1’ },
    { name: ‘Id_Reading2’ },
    { name: ‘Id_Reading3’ },
    { name: ‘Id_Reading4’ },
    { name: ‘Id_Reading5’ },
    { name: ‘Name_Reading1’ },
    { name: ‘Name_Reading2’ },
    { name: ‘Name_Reading3’ },
    { name: ‘Name_Reading4’ },
    { name: ‘Name_Reading5’ }
    ],

    How can i get this. I have tried to modify parameters on ‘series’ parameter but i can’t get it. This is my current code:

    valueAxis:{
    unitInterval: 10,
    minValue: 0,
    maxValue: 100,
    description: ‘Readings’,
    displayValueAxis: true,
    showGridLines: true,
    tickMarksColor: ‘#888888’
    },
    series: [{ dataField: ‘Id_Reading1’, displayText: source.datafields.push({ name: ‘Name_Reading1’})},
    { dataField: ‘Id_Reading2’, displayText: source.datafields.push({ name: ‘Name_Reading2’})},
    { dataField: ‘Id_Reading3’, displayText: source.datafields.push({ name: ‘Name_Reading3’})},
    { dataField: ‘Id_Reading4’, displayText: source.datafields.push({ name: ‘Name_Reading4’})},
    { dataField: ‘Id_Reading5’, displayText: source.datafields.push({ name: ‘Name_Reading5’})}]

    }]

    Thanks in advance


    Dimitar
    Participant

    Hello leopini,

    Here is how to get the values of the datafields as displayText:

    valueAxis:{
    unitInterval: 10,
    minValue: 0,
    maxValue: 100,
    description: ‘Readings’,
    displayValueAxis: true,
    showGridLines: true,
    tickMarksColor: ‘#888888′
    },
    series: [{ dataField: 'Id_Reading1', displayText: source.datafields[6].name},
    { dataField: 'Id_Reading2', displayText: source.datafields[7].name},
    { dataField: 'Id_Reading3', displayText: source.datafields[8].name},
    { dataField: 'Id_Reading4', displayText: source.datafields[9].name},
    { dataField: 'Id_Reading5', displayText: source.datafields[10].name}]
    }]

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/


    leopini
    Member

    Dimitar thanks for your answer.

    I applied that code, however, the string that i get is the name of the field: ‘Name_Reading1’, ….

    I mean, what i need to get is the value of the field. Each one of these fields contain a string stating the name of the variable in the series.

    I need to show that value.

    Example:

    In the database this field ‘Name_Reading1’ = ‘Description Of Temperature’
    ‘Name_Reading2’ = ‘Current Reading’
    ‘Name_Reading3’ = ‘Level of water’

    Now, in the graph the DisplayText must show []’Description Of Temperature’ [] ‘Current Reading’ [] ‘Level of water’

    The values of ‘Name_Reading1’, ‘Name_Reading2’, etc, could change, so, displayText can not be a prefixed string. it mus be read from database by using this fields ‘Name_Reading1’, ‘Name_Reading2’, …

    Thank you again.


    Dimitar
    Participant

    Hi leopini,

    To learn how to bind a jqxChart to a database, please refer to the following entry in the documentation: Bind jqxChart to SQL Database using ASP .NET MVC3.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.