jQWidgets Forums

jQuery UI Widgets Forums Chart Custom data

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

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Custom data Posts
  • Custom data #82280

    mykola
    Participant

    Hi!
    Is it possible to add some custom data fields to series?
    What I want is if I have such fields:

    datafields: [{ name: 'Date', type: 'date' }, { name: 'price-actual'}
        , { name: 'myData1'}, { name: 'price-close1'}, {name: 'price-open1'}
        , { name: 'myData2'}, { name: 'price-close2'}, {name: 'price-open2'}
    ],

    and these series groups:

    var mySeriesGroups = [{
        type: 'candlestick', 
        toolTipFormatFunction: toolTipCustomFormatFn,
        series: [{ displayText: '1-st away', lineColor: '#993300', fillColor: '#993300',
              dataFieldClose: 'price-close1', dataFieldOpen:'price-open1',
              dataFieldHigh: 'price-close1', dataFieldLow:'price-open1'}]
      }, {
        type: 'candlestick', 
        toolTipFormatFunction: toolTipCustomFormatFn,
        series: [{ displayText: '2-nd away', lineColor: '#333300', fillColor: '#333300',
              dataFieldClose: 'price-close2', dataFieldOpen: 'price-open2',
              dataFieldHigh: 'price-close2', dataFieldLow: 'price-open2'}]
    }];

    how would I read “myData1” and “myData2” inside toolTipCustomFormatFn function?
    If I just add them as fields to series, like this:

        series: [{ displayText: '2-nd away', lineColor: '#333300', fillColor: '#333300',
              dataFieldClose: 'price-close2', dataFieldOpen: 'price-open2', <strong>myData: 'myData2'</strong>,
              dataFieldHigh: 'price-close2', dataFieldLow: 'price-open2'}]

    I will get a string with ‘myData2’ value when I try to read serie.myData in toolTipCustomFormatFn function instead of an actual data.

    Custom data #82285

    Hristo
    Participant

    Hello mykola,

    One option is to use Your ‘dataAdapter’ (something similar to var dataItem = dataAdapter.records[itemIndex];).
    With this approach would get each one datafield.
    You could look at our demo:
    http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxchart/javascript_chart_financial_series_ohlc.htm?arctic

    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.