Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9218613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:54:16+00:00 2026-06-18T02:54:16+00:00

Trying to build a timeline in Flex, Have a horizontal slider when i slide

  • 0

Trying to build a timeline in Flex, Have a horizontal slider when i slide the slider there should be a line on the linechart as a needle moving with respect to value of slider,I Tried using gridlines to achieve this but the grid lines are visible across all the values of x axis,But I want to show only single gridline with respect to value of slider. Is there a way to hide few grid lines and show specific gridlines.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:54:18+00:00Added an answer on June 18, 2026 at 2:54 am

    Here’s something I created in about 30 minutes. It’s very rudimentary, and has some issues that I will leave for you to solve (or you can post a new question specific to the remaining issues). It’s likely you’ll need to modify this to suit your application anyway, so I didn’t bother looking at the remaining issues.

    I’ve assumed you’re using Date objects for the horizontal axis of the chart. As such you need to convert the date object to it’s corresponding numerical value (in epoch time). This allows you to work with the slider component, which expects numbers.

    If you do have further questions, I recommend trying to post whatever code you’re using (or a simple version of it), that others can run. That way the answers you get will be specific to your case, and not generic like this one 🙂

    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   creationComplete="onCreationComplete()">
    
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
    
                import spark.primitives.Line;
    
                [Bindable] private var chartData : ArrayCollection =
                    new ArrayCollection(
                        [
                            { sales: 101000, month: new Date( '01/01/2013' ) },
                            { sales: 350000, month: new Date( '02/01/2013' ) },
                            { sales: 475000, month: new Date( '03/01/2013' ) },
                            { sales: 425000, month: new Date( '04/01/2013' ) }
                        ] );
    
                private var line:Line;
    
                private function onCreationComplete():void
                {
                    line = new Line();
                    line.height = chart.height;
                    line.stroke = new SolidColorStroke(0x0000FF, 2);
                    chartContainer.addElement(line);            }
    
                private function getDateInEpochTime(date:Date):Number
                {
                    return date.time;
                }
    
                private function dataTipFormatFunction(value:Number):Object
                {
                    return new Date(value).toString();
                }
    
                private function onSliderChange():void
                {
                    line.x = convertSliderValueToXCoordinate();
                }
    
            private function convertSliderValueToXCoordinate():Number
            {
                var min:Number = slider.minimum;
                var max:Number = slider.maximum;
                var adjustedValue:Number = slider.value - min;
                var range:Number = max - min;
                var percentOfRange:Number = adjustedValue/range
                var xCoordinate:Number = slider.width * percentOfRange;
                var thumbWidth:Number = slider.thumb.width;
                if (percentOfRange > .5)
                    xCoordinate = xCoordinate - (thumbWidth * (percentOfRange - .5));
                else if (percentOfRange < .5)
                    xCoordinate = xCoordinate + (thumbWidth * (.5 - percentOfRange));
                return xCoordinate;
            }
    
            ]]>
        </fx:Script>
    
        <s:Group id="chartContainer" width="800" height="600">
            <mx:LineChart id="chart" dataProvider="{chartData}" left="0" right="0" top="0" bottom="20">
                <mx:horizontalAxis>
                    <mx:DateTimeAxis id="hAxis" dataUnits="months" alignLabelsToUnits="true" displayLocalTime="true"/>
                </mx:horizontalAxis>
                <mx:series>
                    <mx:LineSeries displayName="Sales by Month" yField="sales" xField="month">
                        <mx:lineStroke>
                            <s:SolidColorStroke color="0xFF0000" />
                        </mx:lineStroke> 
                    </mx:LineSeries> 
                </mx:series>
            </mx:LineChart>
            <s:HSlider id="slider" left="0" right="0" bottom="0"
                       dataTipFormatFunction="dataTipFormatFunction"
                       minimum="{getDateInEpochTime(chartData.getItemAt(0).month)}"
                       maximum="{getDateInEpochTime(chartData.getItemAt( chartData.length -1 ).month)}"
                       change="onSliderChange()"/>
        </s:Group>
    </s:Application>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a std::vector< tr1::shared_ptr<mapObject> > that I'm trying build from data contained in
I´m trying to build a Game with DirectX 11 on Windows 7. I have
I am having an issue when trying to build an Annotated Timeline Graph using
I am trying to build a simple twitter timeline feature into one of my
I'm trying build a excel based input form, I have found something online and
I have a small problem when trying build an XML document with Nokogiri. I
In trying to build a ant script for my Flex project i've come across
Trying to build a ajax comment system .I have a list populated from MYSQL
I trying to build and compile my xcodeproj in command line and it is
I am trying build a jQuery EasyUI datagrid or treegrid out of a large

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.