4 Replies Latest reply on Jul 13, 2009 4:02 AM by Richard_Abbott

    Horizontal scroll bar with Line charts

    KalavatiSingh Level 1

      Hi,

             I want  a scrollable bar attached to x-axis as in this example(fourth one in the following URL---http://www.connectedpixel.com/blog/scrollingcharts).I able to find these feature only with ColumnCharts .Can any one tell whether can we apply the same to LineCharts .I request you to send some docs/examples of scrollbar with Line Charts

       

       

       

      Regards

      Kalavati

      kalavati_singh@yahoo.co.in

        • 1. Re: Horizontal scroll bar with Line charts
          KalavatiSingh Level 1

          I mean  I  need to implement a horizontal scrollbar.

           

           

           

          Regards

          Kalavati

          • 2. Re: Horizontal scroll bar with Line charts
            Richard_Abbott Level 3

            Hi Kalavati,

            derive your own class from something suitable (like Panel), add a line chart and scroll bar as components, then hook up the chart axis min and max in a suitable way to the scroll bar actions. You can do a similar trick to zoom in by catching the mouse down/up actions on the chart area.

            Richard

            • 3. Re: Horizontal scroll bar with Line charts
              KalavatiSingh Level 1

              Richard.,

                   can you please elaborate.If possible any docs/examples will be of great help

               

               

              Regards

              Kalavati

              kalavati_singh@yahoo.co.in

              • 4. Re: Horizontal scroll bar with Line charts
                Richard_Abbott Level 3

                Kalavati,

                it's all fairly straightforward ActionScript stuff. Create a new ActionScript class derived from Panel. In a suitable handler create the line chart and scroll bar (HScrollbar), position them wherever you want with the x/y/height/width properties, and add them as children (otherwise they won't show up).

                I'm not sure what you're wanting to do with the scroll bar but let's suppose that at the start you show all the x-axis data (which is the default) and have the scrollbar thumb pointer at 100% (ie scrollPosition=maxScrollPosition). Then catch the scroll event. In the handler, work out the percentage across of the current position (this is a whole lot easier if you've set maxScrollPosition=100 to start with), then work out the implied change to the line chart in terms of data values. I don't know if you know in advance the data values or not, but it doesn't really matter. Suppose the horizontal axis is a LinearAxis. keep hold of the data max value along this axis for later use (say max_data_value), then do

                LinearAxis(chart.horizontalAxis).maximum = max_data_value * [the percentage worked out from the scroll bar]

                Richard