jQWidgets Forums

jQuery UI Widgets Forums Chart Chart line color dynamic

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Chart line color dynamic #49472

    simcon94
    Participant

    Hi,
    i have a dynamically chart like this:

    for (var propName in dataAdapter.records[0]) {
      if (propName !== "Date" && propName !== "uid"){
         seriesColumns.push({ dataField: propName, displayText: propName});
      }
      var settings = {
                    title: "Verbrauch " + propName
                    , enableAnimations: true
                    , showLegend: true
                    , padding: { left: 10, top: 5, right: 50, bottom: 5 }
                    , titlePadding: { left: 90, top: 0, right: 0, bottom: 10 }
                    , source: dataAdapter
                    ,categoryAxis:
                    {
                        dataField: 'Date'
                        , showTickMarks: true
                        , tickMarksInterval: 1
                        , tickMarksColor: '#888888'
                        , unitInterval: 1
                        , showGridLines: true
                        , gridLinesInterval: 1
                        , gridLinesColor: '#888888'
                        , valuesOnTicks: true
                        , textRotationAngle: 45
                    },
                   
                    seriesGroups:
                    [
                        {
                            type: 'line'
                            , toolTipFormatFunction: toolTipCustomFormatFn
                            , valueAxis:
                            {
                                minValue: 0
                                , displayValueAxis: true
                                , description: 'Wert'
                                , axisSize: 'auto'
                                , tickMarksColor: '#888888'
                                , formatSettings:
                                    {
                                        decimalSeparator: ',', thousandsSeparator: '.'
                                    }
                            },
                            series:
                                seriesColumns
                        }
                    ]
                }; 
    }

    thats works perfect with this json:
    [{"Date": "02/2013","1": "6884856.6960000000","2": "30711862.1209501000"}]
    So now i want to set the line color with the dataadapter:

    [{"Date": "02/2013","1": "6884856.6960000000","1-Color": "#F5F900","2": "30711862.1209501000","2-Color": "#FF0000"}]

    seriesColumns.push({ dataField: propName, displayText: propName, color: ????});

    How can i set the Color?

    Chart line color dynamic #49517

    Dimitar
    Participant

    Hello simcon94,

    I assume this is the same query as in the forum topic myScheme Color from Database.

    First, you should change “1-Color” and “2-Color” to something like “oneColor” and “twoColor” (to avoid the hyphen-minus). Your code, then, should be as follows:

    seriesColumns.push({ dataField: propName, displayText: propName, color: dataAdapter.records[0].oneColor});

    Best Regards,
    Dimitar

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

    Chart line color dynamic #49519

    simcon94
    Participant

    Thanks….

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

You must be logged in to reply to this topic.