Script for overriding category axis tick marks in graphs?

Hello!
We are introducing a new graph design, but has a problem with not being able to override the tick marks in the category axis in Illustrator CS5.
A typical graph (line layout) can have 250 observations, and since we have the tick marks on full width, the graph gets "crowded" with black lines.
In the value axis there is possibilites for overriding the values, but not on the category axis.
Is there any way to script so that the tick marks in the category axis can be reduced/overrided to e.g. 1 in 20?
Please help!

Script has NO access to live graph data… It can only break them… then fish in the group for bits…

Similar Messages

  • Graph control right-hand Y-axis tick marks look like negative signs

    Hi,
    The graph control right-hand Y-axis tick marks just to the left of the numeric values that make up the scale look like negative signs.  It gets confusing for the user of the software.
    The left Y-axis is OK because the little tick marks are to the right of the number.
    Any ideas on how to improve this situation?
    Thanks,
    Kirk Mitchell
    Project Engineer
    Kollmorgen

    Perry,
    First of all thanks for looking at this.
    The tick-marks controlled by the "Mark Origin" option are not the tick marks that are causing the problem.
    The Mark Origin ticks are in the body of the graph along the x=0 and y=0 lines.  They only show up if those lines are visible such as if you have a graph with an x axis range of -100 to +100 and a y axis range of the same.
    The ticks I'm referring to are just to the left of the numeric values that label the right axis.
    Below is a screenshot to illustrate:
    Any other ideas?
    Thanks,
    Kirk

  • Axis tick mark algorithm

    Hi all,
    I've been struggling trying to come up with a suitable algorithm for determining tick marks on an axis based on the range of values the axis should display.
    For example, if my initial data set contains the values
    [5,20,29,51,60,63,79,95]
    I can get the Range of 90
    I can specify I want, say, 5 tick marks on my axis, so my interval between marks is 90/5 = 18
    so I could create an axis with values displayed of 0,18,36,54,72,90
    but what I'd like to display here is 0,25,50,75,100 (ie more useful/readable values)
    the axis will also have to cope with floats and negative values, so my data set could be....
    [-5,-2.5,3.9,50.2, 80.9]
    and if I specified ten tick marks Id want output of something like:
    -10,0,10,20,30,40,50,60,70,80
    If anyone has any ideas or can point me towards some source which does this kind of calculation I'd be very grateful.
    Thanks in advance,
    Dylan

    In general, since the factor of 10 are 1,2 and 5, you want to place tic marks at units that are either 1, 2 or 5 "units" apart, where "unit" is some power of ten like .01, .1, 1, 10, 100 etc.
    Secondly, if your picture has 1000 tic marks, there will be too many of them. If there is only one tic mark, or maybe two, you havent given the person enough to look at.
    This argues that there should be some reasonable number of tic mark as a target that you are shooting for, like 10 or 20 or something like that.
    SO - given any range, that you want to cover, and given any "unit", and given any choice of multiplier (1, 2 or 5) you could calculate how many tics it would take to cover that range.
    Given a target number of tics that you think is optimal you should be able to very quickly find the unit and multiplier that gives you the optimal number of tics.
    For extra beauty, draw tics that land on multiples of 10 long, draw tics that land on multiples of 5 medium and draw ones that land on anything else short.
    Enjoy!

  • Less tick marks in graphs?

    Hello!
    We are introducing a new graph design, but has a problem with not being able to override the tick marks in the category axis in Illustrator CS5.
    A typical graph (line layout) can have 250 observations, and since we have the tick marks on full width, the graph gets "crowded" with black lines.
    In the value axis there is possibilites for overriding the values, but not on the category axis.
    Is there any way to script so that the tick marks in the category axis can be reduced/overrided to e.g. 1 in 20?
    Please help!

    Script has NO access to live graph data… It can only break them… then fish in the group for bits…

  • Script for Overriding, Outlining, and Clearing Masters

    As part of the submission process for one of our printers, we have to outline all the text on a set of labels. I've been trying to write a script to do three steps:
    1. Override all Master page objects
    2. Apply [none] master to all pages
    3. Outline all text
    I've gotten pretty far, but I seem to have hit a stumbling block on the Apply [none] master step. Any suggestions?
    var myDocument = app.activeDocument;
    var TotalPages = (myDocument.pages.count());
    for(var CurrentPage=0; CurrentPage < TotalPages; CurrentPage++) {
         OverrideMasterItems();
    function OverrideMasterItems() {
         myDocument.pages[CurrentPage].appliedMaster.pageItems.everyItem().override(myDocument.pages[CurrentPage]);
    //this next part is where I have the problem... I would think it would select all the pages in the document, then change the master page to "null" but it doesn't seem to have any effect at all.
    try{
        app.activeDocument.pages.everyItem().getElements().changeMaster(null);
        }catch(e){};
    //then this final part is working fine.
    try{
        app.activeDocument.textFrames.everyItem().createOutlines();
        }catch(e){};

    I can't help with your script, but I'll give you the standard advice that oulining text is bad practice, and toatally unnecessary in any reasonalby modern workflow that doesn't involve a cutting machine for making signs, or similar. You should find out WHY this printer seems to think it's necessary when ID automatically embeds all non-protected fonts in a PDF.
    If you still want to outline, you don't want to do it by converting text to outlines before exporting. You'll lose all your automated bullets and list numbers and any underlines or paragraph rules. Far better to let the transparency flattener do the job during export. See Possible bug: oulining text w/ flattener in CS5

  • X-axis tick marks and labels

    Is there a way I can apply a vertical orientation to the x-axis labels on a chart?

    David,
    This is currently not an option within xMII.  The only workaround would be to butt a html table cell up to it and have the orientation go vertical for the words.
    Regards,
    Erik

  • Hardcoding a 'tick mark' in the script.

    I have inserted a sapsymbol('tick'  mark) in script by following these steps:
    se71->
    Window-> text editor->Insert->characters->sap symbols. It automatically takes up the value as 640, but this is getting displayed as' # ' in the layout instead of 'tick' mark.
    Do we have to specially handle the sap symbols?
    Could someone help me with this.
    Thanks in Advance,
    Shruti

    Hi ,
      Thanks for the response.Jus wanted to re-confirm the things.
    The 'tick mark' is already available in the list of SAPSymbols in text editor of se71 tcode. I think there is some particular way to use these SAPsymbols. As we can find the id for the tick mark as '00709' in the standard program for symbols .i.e.
    'RSTXSYMB'. It gives a list of all the SAPSymbols. I tried using the same id, but still no change in display of that symbol. Could you kindly confirm if there is really no way to use these symbols. I tried almost all possibilities.
    Thanks again for ur precious time n input.
    Shruti

  • Obtaining grid lines for every tick mark in a chart

    I would like to create a chart that contains gridlines for each tick mark. Furthermore, I'd like to keep the notion of major tick marks being longer and being the only labeled tick marks. It seems that the XYChart is only placing gridlines for major tick marks. Pouring over the API doc, I cannot find a way to make it draw gridlines for the minor tick marks.
    Is this possible out of the box?
    If not, what is the correct solution? A subclass of ValueAxis?
    Thanks,
    Karl

    Paru told me that it is not possible and to file a bug.
    http://javafx-jira.kenai.com/browse/RT-17285
    Karl

  • Check Box With Tick Mark on Sap Script

    Hello All,
    We need to add a check box with tick mark on Sap Script.Please can anyone let me know how can we add it.
    Regards
    Amruta

    hi amruta,
    The soluti as an image into on to your problem can be to use the symbol icon as told , but this may show in preview not in print.
    I too faced the same problem.
    So what i had done is created a new window with the diemnsions of the chekc box with border thcikness 8 tw and inside that window place a checkmark symbol.
    if this checkmark symbol also does not show up in print preview/  doesshow in print preview and not in print then you can scan a chekcmark image and upload it into business document server as a BMP/ TIFF image and use this image in your checkbox window.
    Hope this solves your problem.
    Warm Regards
    Venugopal.T

  • Category Axis for dates display problems

    I am experiencing an odd display behavior in my flex chart.
    The xml for the chart skips some time, for example:
    <item date="10/31/2006" val="57"/>
    <item date="12/27/2006" val="55"/>
    <item date="02/14/2007" val="44"/>
    <item date="02/22/2007" val="43"/>
    <item date="02/28/2007" val="59"/>
    <item date="02/28/2007" val="58"/>
    <item date="03/03/2007" val="35"/>
    But when it displays on the axis, it displays the labels like
    so:
    10/31/2006 2/22/2007 03/03/2007 etc....
    Here is my definition of the CategoryAxis.
    <mx:horizontalAxis>
    <mx:CategoryAxis id="h1" categoryField="date"
    labelFunction="formatLabel"
    dataProvider="{instrument.lastResult.dataset.rightaxis.series.item}"
    title="{instrument.lastResult.dataset.bottomTitle}"/>
    </mx:horizontalAxis>
    Is this a bug? The chart uses two vertical axis as well.
    Maybe this is causing the problem. Ideally I'd just like to define
    a start and end date for the bottom axis and have it display the
    months uniformly. Is there a way to do that or at least fix this
    odd behavior?

    I am experiencing an odd display behavior in my flex chart.
    The xml for the chart skips some time, for example:
    <item date="10/31/2006" val="57"/>
    <item date="12/27/2006" val="55"/>
    <item date="02/14/2007" val="44"/>
    <item date="02/22/2007" val="43"/>
    <item date="02/28/2007" val="59"/>
    <item date="02/28/2007" val="58"/>
    <item date="03/03/2007" val="35"/>
    But when it displays on the axis, it displays the labels like
    so:
    10/31/2006 2/22/2007 03/03/2007 etc....
    Here is my definition of the CategoryAxis.
    <mx:horizontalAxis>
    <mx:CategoryAxis id="h1" categoryField="date"
    labelFunction="formatLabel"
    dataProvider="{instrument.lastResult.dataset.rightaxis.series.item}"
    title="{instrument.lastResult.dataset.bottomTitle}"/>
    </mx:horizontalAxis>
    Is this a bug? The chart uses two vertical axis as well.
    Maybe this is causing the problem. Ideally I'd just like to define
    a start and end date for the bottom axis and have it display the
    months uniformly. Is there a way to do that or at least fix this
    odd behavior?

  • Invisible hands for a clock holding the tick mark as a png

    I am making the hands of a clock with tick marks held in a particular spot with an invisible bounding box.  When I export as a png the bounding box disappears and all I have is the tick mark.  Any suggestions?  Any help would be appreciated! Maybe a boundindg box isn't the correct description?  I have made the hand  using the rectangle shape with no fill and no line. The tick mark is contained within this space.  But somehow when it is exported using png the invisible containment disappears.  I need that to hold my tick mark in place as the hand goes around the clock.
    Marci

    The image fits inside the rectangle at a precise point. But when I export it, all I get is the tick mark which looks like this without the rectangle
    This is what happened the first one when I exported it as a png.  The second I matched the artboard and tried to save it as a eps.  I still get the same result.  I was able to do this originally but it had a white fill.  It needed to be transparent.  But when I make it transparent the box disappears when it is exported.

  • Is it possible to display a TickLabel on minor tick marks?

    I am trying to figure out whether it is possible to display a label on minor tick marks in a LineChart. I can't immediately gleam from the NumberAxis > ValueAxis > Axis javadoc how / if this could be possible to do. Tried experimenting a bit with making my own custom Axis class seeing if anything would pop when I started overriding methods, but no, not really.
    The issue I'm trying to solve is having the minor tick marks labeled on the chart when it is zoomed in. Currently, if I zoom in on a region contained between two major tick marks, there will be no axis labels at all (except the bottom left corner), which is unacceptable. I need to be able to label those minor ticks at some level of zoom to make the chart more readable.
    If anybody have any ideas on how to proceed with this problem, greatly appreciated.

    Bump. Is there any resolution for this issue?

  • Flex 4 HSlider Tick Marks?

    How would one go about doing this. I have a class extending the Spark HSlider and a skin for it, but what kind of Display Object should I used to display the values for Tick Marks..
    some code below: I figured DataGroup as a possible repeater component, but nothing shows.  Any help being able repeat a set of Lines with X and Y values would be greatly appreciated.
    Thanks,
    Skitch
    PlayerSlider.as (Component):
    import mx.collections.ArrayCollection;
        import spark.components.DataGroup;
        import spark.components.HSlider;
        public class PlayerSlider extends HSlider
            [SkinPart(required="false")]
            public var tickMarks:DataGroup;
            public function PlayerSlider()
                super();
            [Bindable]       
            public function set tickValues(value:ArrayCollection):void
                _tickValues = value;
                _tickValuesChanged = true;
                invalidateProperties();
            public function get tickValues():ArrayCollection { return _tickValues; }
            protected var _tickValues:ArrayCollection;
            protected var _tickValuesChanged:Boolean = false;
             * Adding the prompt text to the label if it's available
            override protected function commitProperties():void
                super.commitProperties();
                if (this._tickValuesChanged)
                    if (tickMarks)
                        tickMarks.dataProvider = tickValues;
                    this._tickValuesChanged = false;
            override protected function partAdded(partName:String, instance:Object):void
                super.partAdded(partName, instance);
                if (instance == tickMarks)
                    tickMarks.dataProvider = tickValues;
    PlayerSliderSkin.mxml (SkinClass):
    <?xml version="1.0" encoding="utf-8"?>
    <s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:fb="http://ns.adobe.com/flashbuilder/2009" minHeight="11" alpha.disabled="0.5" xmlns:mx="library://ns.adobe.com/flex/mx">
        <fx:Metadata>[HostComponent("com.digitalsmiths.util.playerSlider.PlayerSlider")]</fx:Meta data>
        <fx:Script fb:purpose="styling">
            /* Define the skin elements that should not be colorized.
               For slider, the skin itself is colorized but the individual parts are not. */
            static private const exclusions:Array = ["track", "thumb"];
             * @private
            override public function get colorizeExclusions():Array {return exclusions;}
             * @private
            override protected function initializationComplete():void
                useChromeColor = true;
                super.initializationComplete();
        </fx:Script>
        <fx:Script>
             *  @private
            override protected function measure() : void
                // Temporarily move the thumb to the left of the Slider so measurement
                // doesn't factor in its x position. This allows resizing the
                // HSlider to less than 100px in width.
                var thumbPos:Number = thumb.getLayoutBoundsX();
                thumb.setLayoutBoundsPosition(0, thumb.getLayoutBoundsY());
                super.measure();
                thumb.setLayoutBoundsPosition(thumbPos, thumb.getLayoutBoundsY());
        </fx:Script>
        <s:states>
            <s:State name="normal" />
            <s:State name="disabled" />
        </s:states>
        <fx:Declarations>
            <!--- The tooltip used in the mx.controls.Slider control.
                   To customize the DataTip's appearance, create a custom HSliderSkin class.-->
            <fx:Component id="dataTip">    
               <s:DataRenderer minHeight="24" minWidth="40" y="-34"> 
                  <s:Rect top="0" left="0" right="0" bottom="0">
                        <s:fill>
                            <s:SolidColor color="0x000000" alpha=".9"/>
                        </s:fill>
                        <s:filters>
                            <s:DropShadowFilter angle="90" color="0x999999" distance="3"/>
                        </s:filters>
                    </s:Rect>
                    <s:Label id="labelDisplay" text="{data}"
                             horizontalCenter="0" verticalCenter="1"
                             left="5" right="5" top="5" bottom="5"
                             textAlign="center" verticalAlign="middle"
                             fontWeight="normal" color="white" fontSize="11">
                    </s:Label>
                </s:DataRenderer>
           </fx:Component>
        </fx:Declarations>
        <!--- The default skin class is HSliderTrackSkin.
        @copy spark.components.supportClasses.TrackBase#track
        @see spark.skins.spark.HSliderTrackSkin -->
        <s:Button id="track" left="0" right="0" top="0" bottom="0" minWidth="33" width="100"
                  skinClass="styling.skinClasses.sliders.track.HSliderTrackSkin"/>
        <!--- The default skin class is HSliderThumbSkin.
        @copy spark.components.supportClasses.TrackBase#thumb
        @see spark.skins.spark.HSliderThumbSkin -->
        <s:Button id="thumb" top="0" bottom="0" width="4" height="11"
                  skinClass="styling.skinClasses.sliders.thumb.HSliderThumbSkin"/>
        <s:DataGroup id="tickMarks" left="0" right="0" top="0" bottom="0" minWidth="33" width="100">
            <s:layout>
                <s:BasicLayout/>
            </s:layout>
            <s:itemRenderer>
                <fx:Component>
                    <s:ItemRenderer>
                        <s:Line
                            height="100%">
                            <s:stroke>
                                <s:SolidColorStroke color="0x525254"/>
                            </s:stroke>
                        </s:Line>
                    </s:ItemRenderer>
                </fx:Component>
            </s:itemRenderer>
        </s:DataGroup>
    </s:SparkSkin>

    These threads might be useful for you:
    http://forums.adobe.com/message/2486681#2486681
    http://forums.adobe.com/message/2476351#2476351
    In CustomSlider4.zip there is a skin file called HSliderTrackSkinTicks.mxml that shows a very simple way of implementing tick marks.  DataGroup should work too, but it will be a little trickier to line up the ticks properly.

  • Java Fx Category Axis out of order

    I have a chart where I REPLACE the data in a XY chart with new String,Number pairs and I get the category axis labels out of order. They retain part of the order of the previous chart that has had its data deleted.
    Here is a demo app that shows the behavior. Just click on the chart a couple of times while looking at the x axis. The first time the data is plotted all is ok, after other data is plotted, the category axis gets screwed up for the original data.
    Any help?????
    Tom
    package testCategoryBug;
    import javafx.application.Application;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.event.EventHandler;
    import javafx.scene.chart.CategoryAxis;
    import javafx.scene.chart.NumberAxis;
    import javafx.scene.chart.XYChart;
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.chart.LineChart;
    import javafx.scene.chart.XYChart.Data;
    import javafx.scene.chart.XYChart.Series;
    import javafx.scene.input.MouseEvent;
    public class TestCategoryBug extends Application {
          static Boolean even=true;
        @Override public void start(Stage stage) {
            stage.setTitle("Test Category Bug");   
            final CategoryAxis xAxis = new CategoryAxis();
            final NumberAxis yAxis = new NumberAxis();
            xAxis.setLabel("Month");      
            final LineChart<String,Number> lineChart = new LineChart<String,Number>(xAxis, yAxis);      
            lineChart.setTitle("Stock Monitoring, 2010");    
            // Initialize some data for plotting.
             final Series<String, Number> plottablePairs  = new Series<String, Number>();
             final Series<String, Number> plottablePairs2 = new Series<String, Number>();
            for (int i = 0; i < 10; i++) {
                Data<String,Number> pair= new Data<String,Number>("Month "+i,10.0*i);
                plottablePairs.getData().add(pair);
            for (int i = 5; i < 10; i++) {
                Data<String,Number> pair= new Data<String,Number>("Month "+i,100.0-10*i);
                plottablePairs2.getData().add(pair);
            // add the first of the series
              final ObservableList<XYChart.Series<String, Number>> chartData=FXCollections.observableArrayList();;
              chartData.add(plottablePairs);
              lineChart.setData(chartData);
              // now on a mouse click, swap the data.  Click twice and see what happens
              lineChart.addEventHandler(MouseEvent.MOUSE_CLICKED,new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent e) {
                    chartData.clear();
                    if (even) {
                        chartData.add(plottablePairs2);
                    } else {
                        chartData.add(plottablePairs);
                        // note that after this, the axis is screwed up.
                    lineChart.setData(chartData);
                    even=!even;
              // Put up the scene
              Scene scene  = new Scene(lineChart,800,600);
              stage.setScene(scene);
              stage.show();
        public static void main(String[] args) {
            launch(args);

    Obviously you just posted a simple example to demonstrate the problem, so I don't know if this workaround works for your real application, but could you just replace the entire chart?
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.scene.chart.CategoryAxis;
    import javafx.scene.chart.NumberAxis;
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.chart.LineChart;
    import javafx.scene.chart.XYChart.Data;
    import javafx.scene.chart.XYChart.Series;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.BorderPane;
    public class TestCategoryBug extends Application {
      private boolean even = true;
      @Override
      public void start(Stage stage) {
        stage.setTitle("Test Category Bug");
        // Initialize some data for plotting.
        final Series<String, Number> plottablePairs = new Series<String, Number>();
        final Series<String, Number> plottablePairs2 = new Series<String, Number>();
        for (int i = 0; i < 10; i++) {
          Data<String, Number> pair = new Data<String, Number>("Month " + i,
              10.0 * i);
          plottablePairs.getData().add(pair);
        for (int i = 5; i < 10; i++) {
          Data<String, Number> pair = new Data<String, Number>("Month " + i,
              100.0 - 10 * i);
          plottablePairs2.getData().add(pair);
        final BorderPane root = new BorderPane();
        displayLineChart(root, plottablePairs, plottablePairs2);
        // now on a mouse click, swap the data. Click twice and see what happens
        root.addEventHandler(MouseEvent.MOUSE_CLICKED,
            new EventHandler<MouseEvent>() {
              @Override
              public void handle(MouseEvent e) {
                even = !even;
                displayLineChart(root, plottablePairs, plottablePairs2);
        // Put up the scene
        final Scene scene = new Scene(root, 800, 600);
        stage.setScene(scene);
        stage.show();
      private void displayLineChart(BorderPane root, Series<String, Number> plottablePairs, Series<String, Number> plottablePairs2) {
       final CategoryAxis xAxis = new CategoryAxis();
        xAxis.setLabel("Month");
        final NumberAxis yAxis = new NumberAxis();
        LineChart<String, Number> lineChart = new LineChart<>(xAxis, yAxis);
        lineChart.setTitle("Stock Monitoring, 2010");
        if (even) {
          lineChart.getData().add(plottablePairs2);
        } else {
          lineChart.getData().add(plottablePairs);
        root.setCenter(lineChart);
      public static void main(String[] args) {
        launch(args);

  • LineChart category axis labelFunction / dataProvider problem

    Hi,
    I am trying to plot a line chart using actionscript.
    What I am trying to achive is plot the chart with entire dataset, but show only limited number of points in x and y axis's.
    Problem:
         When I give dataProvider to category axis with some limited values, nothing gets plotted .
    Explaination:
         In the attached main.mxml file
                    var lineCategoryXAxis:CategoryAxis = new CategoryAxis();
                    //lineCategoryXAxis.dataProvider = getDatePointsArray(datesArray);
                    lineCategoryXAxis.categoryField = "DATE";
                    lineCategoryXAxis.labelFunction = lineCategoryXAxisLabelFunction;
                    lineChart.horizontalAxis = lineCategoryXAxis;
    Here, I am giving category axis for x-axis. Linechart takes care of values in the vertical axis by itself and so the line chart gets plotted properly.
    But when I try giving values to vertical axis, then nothing is plotted in the line chart.
                    var lineCategoryYAxis:CategoryAxis = new CategoryAxis();
                     lineCategoryYAxis.dataProvider = getNumericPointsArray(valuesArray)
                     //lineCategoryYAxis.categoryField = "VALUE";
                     lineCategoryYAxis.labelFunction = lineCategoryYAxisLabelFunction;
                     lineChart.verticalAxis = lineCategoryYAxis;
    Also if I try to reduce the number of points in the x-axis, nothing gets plotted
                   var lineCategoryXAxis:CategoryAxis = new CategoryAxis();
                     lineCategoryXAxis.dataProvider = getDatePointsArray(datesArray);
                     lineCategoryXAxis.labelFunction = lineCategoryXAxisLabelFunction;
                     lineChart.horizontalAxis = lineCategoryXAxis;
    where getNumericPointsArray() returns an array with 7 values for vertical axis and getDatePointsArray() returns array with 7 dates for horizontal axis.
    Need help in resolving this problem.
    P.S: Unable to attach mxml file so attaching it as a txt file.

    Hi,
    This is the code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        xmlns:components="com.yahoo.data.digits.components.*"
        layout="vertical"
        backgroundColor="#FFFFFF"
        backgroundGradientAlphas="[0,0]"
        width="100%" creationComplete="cc()">
        <mx:Script>
            <![CDATA[
                import mx.utils.ArrayUtil;
                import mx.collections.XMLListCollection;
                import mx.collections.Sort;
                import mx.charts.CategoryAxis;
                import mx.charts.chartClasses.Series;
                import mx.collections.ArrayCollection;
                import mx.charts.series.LineSeries;
                import mx.charts.LineChart;
                public var dataForLineChart:ArrayCollection = new ArrayCollection([
                                                                {DATE:"20090509", VALUE:"3538943147"},
                                                                {DATE:"20090510", VALUE:"5047760823"},
                                                                {DATE:"20090511", VALUE:"5046865494"},
                                                                {DATE:"20090512", VALUE:"4983771032"},
                                                                {DATE:"20090513", VALUE:"5032039834"},
                                                                {DATE:"20090514", VALUE:"4897303525"},
                                                                {DATE:"20090515", VALUE:"4496020991"},
                                                                {DATE:"20090516", VALUE:"3525547244"},
                                                                {DATE:"20090517", VALUE:"3596982398"},
                                                                {DATE:"20090518", VALUE:"4947978254"},
                                                                {DATE:"20090519", VALUE:"4932182219"},
                                                                {DATE:"20090520", VALUE:"4909069875"},
                                                                {DATE:"20090521", VALUE:"4781830807"},
                                                                {DATE:"20090522", VALUE:"4431176690"},
                                                                {DATE:"20090523", VALUE:"3476323135"},
                                                                {DATE:"20090524", VALUE:"3444512240"},
                                                                {DATE:"20090525", VALUE:"4329018809"},
                                                                {DATE:"20090526", VALUE:"5086390081"},
                                                                {DATE:"20090527", VALUE:"5012778551"},
                                                                {DATE:"20090528", VALUE:"4770167180"},
                                                                {DATE:"20090529", VALUE:"4408927585"},
                                                                {DATE:"20090531", VALUE:"3488537357"},
                                                                {DATE:"20090601", VALUE:"3630748728"},
                                                                {DATE:"20090602", VALUE:"5007093913"},
                                                                {DATE:"20090603", VALUE:"5015210737"},
                                                                {DATE:"20090604", VALUE:"4999236097"},
                                                                {DATE:"20090605", VALUE:"4934609881"},
                                                                {DATE:"20090606", VALUE:"4588135281"},
                                                                {DATE:"20090607", VALUE:"3615291868"},
                                                                {DATE:"20090608", VALUE:"3666209346"},
                private function cc():void
                    var lineSeriesArray:Array = new Array();
                    var lineChart:LineChart = new LineChart();
                    lineChart.percentHeight = 100;
                    lineChart.percentWidth = 100;
                    lineChart.showDataTips = true;
                    lineChart.dataProvider = dataForLineChart;
                    var valuesArray:Array = new Array();
                    var datesArray:Array = new Array();
                    var lineSeries:LineSeries;
                    lineSeries = new LineSeries();
                    lineSeries.dataProvider = dataForLineChart;
                    lineSeries.dataFunction = lineSeriesDataFunction;
                    lineSeriesArray.push(lineSeries);
                    var dLength:int = dataForLineChart.length;
                    for (var k:int=0;k<dLength;k++)
                        valuesArray.push(dataForLineChart[k].VALUE);
                        datesArray.push(dataForLineChart[k].DATE);
                    lineChart.series = lineSeriesArray;
                    var lineCategoryXAxis:CategoryAxis = new CategoryAxis();
                    //lineCategoryXAxis.dataProvider = getDatePointsArray(datesArray);
                    lineCategoryXAxis.categoryField = "DATE";
                    lineCategoryXAxis.labelFunction = lineCategoryXAxisLabelFunction;
                    lineChart.horizontalAxis = lineCategoryXAxis;
                    var lineCategoryYAxis:CategoryAxis = new CategoryAxis();
                    //lineCategoryYAxis.dataProvider = getNumericPointsArray(valuesArray)
                    lineCategoryYAxis.categoryField = "VALUE";
                    lineCategoryYAxis.labelFunction = lineCategoryYAxisLabelFunction;
                    //lineChart.verticalAxis = lineCategoryYAxis;
                    chartContainer.removeAllChildren();
                    chartContainer.addChild(lineChart);
                private function lineCategoryXAxisLabelFunction(categoryValue:Object, previousCategoryValue:Object, axis:CategoryAxis, categoryItem:Object):String
                    /** Will do date formatting here */
                    return categoryItem.DATE;
                    //return categoryItem.toString();
                private function lineCategoryYAxisDataFunction(axis:CategoryAxis, item:Object):Object
                    return item.VALUE;
                private function lineCategoryYAxisLabelFunction(categoryValue:Object, previousCategoryValue:Object, axis:CategoryAxis, categoryItem:Object):String
                    /** Will do number formatting here */
                    return categoryItem.VALUE;
                    //return categoryItem.toString();
                private function lineSeriesDataFunction(series:Series, item:Object, fieldName:String):Object
                    if (fieldName == "yValue")
                        return item.VALUE;
                    else if(fieldName == "xValue")
                        return item.DATE.toString();
                    return null;
                private function getNumericPointsArray(inputArray:Array):Array
                    var numValues:int = inputArray.length;
                    /** Sorting the array to find min and max values */
                    var inputAC:ArrayCollection = new ArrayCollection(inputArray);
                    inputAC.sort = new Sort();
                    inputAC.refresh();
                    var minValue:Number = Number(inputAC.getItemAt(0));
                    var maxValue:Number = Number(inputAC.getItemAt(inputAC.length - 1));
                    var outputArray:Array = new Array();
                    var i:int;
                    var diffFactor:Number;
                    var diffMinMax:Number;
                    /** axis takes 0 by default so not pushing that into array */       
                    if (minValue == maxValue)
                        /** Dividing by 6 to get 5 points */
                        diffFactor = Math.round(maxValue / 6);
                        for (i=1;i<=5;i++)
                            outputArray.push((i * diffFactor));
                        outputArray.push(maxValue);
                    else
                        outputArray.push(minValue);
                        /** Find some points between minValue and maxValue */
                        diffMinMax = (maxValue - minValue);
                        /** Dividing by 5 to get 4 points */
                        diffFactor = Math.round(diffMinMax / 5);
                        for (i=1;i<=4;i++)
                            outputArray.push((i * diffFactor) + minValue);
                        outputArray.push(maxValue);
                    return outputArray;
                private function getDatePointsArray(inputArray:Array):Array
                    var numValues:int = inputArray.length;
                    /** Subtracting 2 because first and last values are undconditinally pushed in output array.*/
                    var stepValue:int = (numValues - 2) / 5;
                    var outputArray:Array = new Array();
                    outputArray.push(inputArray[0]);
                    /** Starting from 1 and ending in numValues - 2 because first and last values of array are already taken.*/
                    for (var i:int=stepValue;i<numValues - 2;i+=stepValue)
                        outputArray.push(inputArray[i]);
                    outputArray.push(inputArray[numValues - 1]);
                    return outputArray;
            ]]>
        </mx:Script>
        <mx:HBox id="chartContainer" width="100%" height="100%">
        </mx:HBox>
    </mx:Application>
    As you can see in the code, my dataPovider is complex (can become much more complex). In the code above, the ArrayCollection has only one element currently but will have more. So the graph should be plotted in such a way that each array element corresponds to one line series.
    What I need to achive is that the horizontal axis should show dates only from the "0th" element of the ArrayCollection and that too only some limited 6-7 points, the rest of the ArrayCollection elements should get plotted according to these dates.
    I think I was able to explain my problem. Pls let me know if any more explaination is required.
    P.S. Re-attaching the file.
    Thanks in advance

Maybe you are looking for

  • Creation of Spool File with Triggers

    Hi, I have created an OnUpdate trigger using the Essbase Console. I am using a calculation script to change the value of an account that is being used in the trigger. The trigger doesnot craete a spool file. Can anyone help me with it.

  • Adobe 9 Pro OCR issue

    I have been running into a constant issue with using the OCR feature in Adobe Pro 9. When opening a document to use OCR to convert the file to a .doc file, I get an error every time I try. I have tried: Saving the file to the desktop and opening the

  • IOS7 Problem

    I am having problems with Internet access only since I updated my IPAD mini to iOS7.  Does anyone know how to fix it or get help from Apple?  Thanks

  • ADF: displaying a running total, howto/code sample needed

    Hi, can anyone point me towards and example of how to display a running total on a page? I have a read only table which i want to display a total of a numeric column. thanks in advance, Brenden

  • WPC Content inside Dynamic Navigaiton

    Hi Experts, I have a requirement, where I need to display WPC content inside Dynamic Navigation. We are using NW Portal 7.4 SP 8 I am using the below approach to display WPC content in content area as well as dynamic navigaiton. With the below mentio