4 Replies Latest reply on Feb 3, 2011 11:04 AM by __Kas

    Color of Datatips in a line Chart

      So I have to following code:

      /***********************************************************************
      <mx:LineSeries
      id="line1"
      dataProvider="{points1}"
      yField="yFiled1"
      displayName="Title1"
      itemRenderer="mx.charts.renderers.DiamondItemRenderer"
      interpolateValues="true"
      sortOnXField="true"
      xField="date">
      <mx:lineStroke>
      <mx:Stroke color="red"/>
      </mx:lineStroke>
      </mx:LineSeries>
      ***********************************************************************/

      This happens to give me a red line with orange data tips. Does anyone know what object or property I can change to over write the color of the dataTip or itemRenderer?
        • 1. Re: Color of Datatips in a line Chart
          babyChart
          I'm no expert either. Maybe you can use LineChart's dataTipFunction property to customize the data tip. I know for sure dataTipFunction allows you to customize the data shown in the popup; but not sure whether it allows you to change the color or style.
          • 2. Re: Color of Datatips in a line Chart
            Sreenivas R Adobe Employee
            You can use a style declaration to modify the styles of the DataTip

            <mx:Style>
            DataTip
            {
            color:#FF0000;
            backgroundColor:#00FF00;
            }
            </mx:Style>

            If you want to control it for each Chart then you need to create a custom component derived from the DataTip class and specify different styles for them.
            • 3. Re: Color of Datatips in a line Chart
              nileshvaze

              Hi,

               

              Not sure if you worked out the problem. This solution worked for me:

               

              <mx:LineSeries

               

              yField="my_data_value" displayName="My Data" itemRenderer="mx.charts.renderers.DiamondItemRenderer">

                   <!-- Set the color of datatips here-->

                   <mx:stroke>

                        <mx:Stroke color="0x0099FF" weight="5"/>

               

                   </mx:stroke>

               

               

                   <!-- Set the color of line chart here-->

                   <mx:lineStroke>

                        <mx:Stroke color="0xFF1100"/>

               

                   </mx:lineStroke>

               

              </mx:LineSeries>

               

              Cheers,

              Nilesh

              • 4. Re: Color of Datatips in a line Chart
                __Kas

                If the LineSeries needs to be created in .as then the code below can be used-

                 

                 

                var lineSer:LineSeries=new LineSeries();

                 

                lineSer.yField="yField";

                 

                lineSer.setStyle("itemRenderer", new ClassFactory(mx.charts.renderers.CircleItemRenderer));

                lineSer.setStyle("stroke", new Stroke(0xC0C0C0 , 2, 1));

                 

                lineSer.setStyle("lineStroke", new Stroke(0xC0C0C0 , 2, 1));

                 

                lineSer.dataProvider=anArrayCollection;

                 

                 

                LineChart.series.push(lineSer);