Problem with Repositioning Chart

Hi, I am currently working on a project for which I am trying to take a column chart and allow the user to click and drag the mouse to create a zoom window. When the mouse is released the chart is zoomed in on the area that was covered by the mouse.
I also want a scroll bar to appear after the chart zooms in so the rest of the chart can be scrolled to in the zoomed-in view. I have written code to do both of these things but I am having a problem. When I drag over the chart to zoom in it zooms fine and the scroll bar appears but the issue is that the portion of the chart that is displayed is the left-most portion, no matter which part I selected to have the view zoom in on. The methods are called when there is a mouseDown, mouseMove, and mouseUp event on the chart, respectively.
   //Declares the zoom variables
   [Bindable]
   private var dragStart:Point;
   private var dragEnd:Point;
   private var TL:Point;
   private var BR:Point;
   private var zooming:Boolean = false;
   //Declares the scroll variables
   private var negProp:int;
   //Sets the start point for the zoom window
   private function startDraw(event:MouseEvent):void
    zooming = true;
    dragStart = new Point(columns.mouseX, columns.mouseY);
   //Draws the zoom window as the mouse moves
   private function showDraw(event:MouseEvent):void
    if(zooming)
     dragEnd = new Point(columns.mouseX, columns.mouseY);
     //Finds the top-left and bottom-right points of the zoom window
     TL = new Point();
     BR = new Point();
     if(dragStart.x < dragEnd.x)
     { TL.x = dragStart.x;
      BR.x = dragEnd.x;
     else
     { TL.x = dragEnd.x;
      BR.x = dragStart.x;
     if(dragStart.y < dragEnd.y)
     { TL.y = dragStart.y;
      BR.y = dragEnd.y;
     else
     { TL.y = dragEnd.y;
      BR.y = dragStart.y;
     //Keeps the zoom window from going off the canvas
     if(TL.x < 0)
      TL.x = 0;
     if(BR.x < 0)
      BR.x = 0;
     if(TL.x > chartCanvas.width - 1)
      TL.x = chartCanvas.width - 1;
     if(BR.x > chartCanvas.width - 1)
      BR.x = chartCanvas.width - 1;
     //Draws the zoom window
     chartCanvas.graphics.clear();
     chartCanvas.graphics.lineStyle(1, 0x000000, 0.25);
     chartCanvas.graphics.beginFill(0xd4ef0, 0.5);
     chartCanvas.graphics.drawRect(TL.x, TL.y, BR.x-TL.x, BR.y-TL.y);
     chartCanvas.graphics.endFill();
   //Clears the drawing canvas and sets the new coordinates
   private function endDraw(event:MouseEvent):void
    zooming = false;
    chartCanvas.clear();
    negProp = TL.x / wipChart.width;
    wipChart.width = (wipChart.width / (BR.x-TL.x)) * wipChart.width;
    wipChart.x = -1 * (negProp * wipChart.width);
If anyone can help me I'd greatly appreciate it. Thank you.

Seems to simply be a problem with your data. See this
code.

Similar Messages

  • Regarding Pages charts, when I try to 'build' a 3D chart all I get is little dots but not graphics.  No problems with 2D charts though. Guess my question is "Help?"

    Regarding Pages charts, when I try to 'build' a 3D chart all I get is little dots but not graphics.  No problems with 2D charts though. Guess my question is "Help?"

    Sorry for the delay getting back to this.
    Thanks to Fruhulda and Peter for their comments regarding the refusal of Pages to let me make 3D charts. 
    In answer to the questions put to  me in this regard :
    1. Pages version : Pages '09  v.4.1 (923)
    2. Mac O/S :          v.10.6.8 
    3. 3D chart :          Can't find a 'name', but upright bars with rounded corners ???
    4. Moved apps :    Not that I'm aware of!  All should be as installed off the disc.
    5. A note :              I have been able to create these in the past - related to a SW update? 
                          and ... can create these charts perfectly in Keynote (go figure).
    Thanks to all.
    CM

  • Problem with Area  Chart

    Hi EveryOne,
    Me having problem with area chart,i have taken 3 area series
    to plot when me plotting the values one of the series is getting
    overlapped,Why its happening like this? Me attached the code
    Thanks in advance.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml">
    <mx:Script><![CDATA[
    import mx.collections.ArrayCollection;
    [Bindable]
    public var expenses:ArrayCollection = new ArrayCollection([
    {Month:"Jan", Profit:0, Expenses:0, Amount:450},
    {Month:"Feb", Profit:5, Expenses:0, Amount:600},
    {Month:"Mar", Profit:5, Expenses:5, Amount:300},
    {Month:"Mar", Profit:0, Expenses:5, Amount:300}
    public var expenses1:ArrayCollection = new ArrayCollection([
    {Month:"Jan", Profit:0, Expenses:5, Amount:450},
    {Month:"Feb", Profit:5, Expenses:5, Amount:600},
    {Month:"Mar", Profit:5, Expenses:10, Amount:300},
    {Month:"Mar", Profit:0, Expenses:10, Amount:300}
    public var expenses2:ArrayCollection = new ArrayCollection([
    {Month:"Jan", Profit:5, Expenses:0, Amount:450},
    {Month:"Feb", Profit:10, Expenses:0, Amount:600},
    {Month:"Mar", Profit:10, Expenses:6, Amount:300},
    {Month:"Mar", Profit:5, Expenses:6, Amount:300}
    ]]></mx:Script>
    <mx:AreaChart id="myChart"
    showDataTips="true">
    <mx:series>
    <mx:AreaSeries id="ara" dataProvider="{expenses}"
    xField="Expenses"
    yField="Profit"
    />
    <mx:AreaSeries id="ara1" dataProvider="{expenses1}"
    xField="Expenses"
    yField="Profit"
    />
    <mx:AreaSeries id="ara2" dataProvider="{expenses2}"
    xField="Expenses"
    yField="Profit"
    />
    </mx:series>
    </mx:AreaChart>
    </mx:Application>

    Seems to simply be a problem with your data. See this
    code.

  • Problem with simple chart

    Hi everyone. I've got a problem with ABAP charts. I need to place a simple chart in screen's container.
    REPORT ZWOP_TEST4 .
    Contain the constants for the graph type
    TYPE-POOLS: GFW.
    DATA: VALUES       TYPE TABLE OF GPRVAL WITH HEADER LINE.
    DATA: COLUMN_TEXTS TYPE TABLE OF GPRTXT WITH HEADER LINE.
    DATA: ok_code LIKE sy-ucomm.
    DATA: my_container TYPE REF TO cl_gui_custom_container.
    REFRESH VALUES.
    REFRESH COLUMN_TEXTS.
    VALUES-ROWTXT = 'Salary'.
    VALUES-VAL1 = 50000.
    VALUES-VAL2 = 51000.
    APPEND VALUES.
    VALUES-ROWTXT = 'Life cost'.
    VALUES-VAL1 = 49000.
    VALUES-VAL2 = 51200.
    APPEND VALUES.
    COLUMN_TEXTS-COLTXT = '2003'.
    APPEND COLUMN_TEXTS.
    COLUMN_TEXTS-COLTXT = '2004'.
    APPEND COLUMN_TEXTS.
    Call a chart into a standard container, this function could be used
    for many different graphic types depending on the presentation_type
    field :
    gfw_prestype_lines
    gfw_prestype_area
    gfw_prestype_horizontal_bars
    gfw_prestype_pie_chart
    gfw_prestype_vertical_bars
    gfw_prestype_time_axis
    CALL SCREEN '1000'.
      CALL FUNCTION 'GFW_PRES_SHOW'
        EXPORTING
          CONTAINER         = 'CONTAINER'    "A screen with an empty
                                            container must be defined
          PRESENTATION_TYPE = GFW_PRESTYPE_LINES
        TABLES
          VALUES            = VALUES
          COLUMN_TEXTS      = COLUMN_TEXTS
        EXCEPTIONS
          ERROR_OCCURRED    = 1
          OTHERS            = 2.
    *&      Module  STATUS_1000  OUTPUT
          text
    MODULE STATUS_1000 OUTPUT.
      SET PF-STATUS 'GUI_1000'.
    SET TITLEBAR 'xxx'.
      IF my_container IS INITIAL.
        CREATE OBJECT my_container
          EXPORTING container_name = 'CONTAINER'.
      ENDIF.
    ENDMODULE.                 " STATUS_1000  OUTPUT
    *&      Module  USER_COMMAND_1000  INPUT
          text
    MODULE USER_COMMAND_1000 INPUT.
      ok_code = sy-ucomm.
      CASE ok_code.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_1000  INPUT
    I created a screen 1000 in SCREENPAINTER, named it 'CONTAINER'. Then I try to launch code above and nothing appears on the screen. Could You give me some tip?

    Hi,
    delete this lines:
    IF my_container IS INITIAL.
    CREATE OBJECT my_container
    EXPORTING container_name = 'CONTAINER'.
    ENDIF.
    then it should work.
    R

  • Problem with displaying chart data

    Hello everybody,
    I have problem with displaying chart data correctly. I'm using a cartesian chart with DateTimeAxis. The stockdata I'm using is for half a year and
    with ticks for every day. The problem is, that Flex displays the data of february in march together with the data of march. I have added a picture
    to show the result. The second column of the grid is for february and the third for march.
    Could anybody help me with this problem. Thanks in advance.
    Thomas

    Hi Chris,
    thanks for your reply. Here you get the source code:
    The following method creates the LineChart:
            public function init():void
                model.upperChart = this;
                model.upperChartStyle.setChartViewStyle(this);
                this.hAxis = new MyDateTimeAxis();
                model.upperChartData.configureHAxis(this.hAxis);
                this.vAxis = new LinearAxis();
                model.upperChartData.configureVAxis(this.vAxis);           
                this.vAxisTitle = new Label();
                this.vAxisTitle.text = model.upperChartData.getVAxisTitle();
                model.upperChartStyle.setVAxisTitleLabelStyle(this.vAxisTitle);
                this.vAxisTitle.x = 10
                this.vAxisTitle.y = 0;
                this.addChild(this.vAxisTitle);
                this.myChart = new CartesianChart();
                //remove default datatip
                this.myChart.showDataTips = false;
                this.myChart.x = 10;
                this.myChart.y = 0;
                this.myChart.width = 768; 
                this.myChart.height = 196;
                model.upperChartStyle.setChartStyle(this.myChart);
                this.addChild(this.myChart);
                //Remove line shadow
                this.myChart.seriesFilters = null;
                this.myChart.horizontalAxis = this.hAxis;
                this.myChart.verticalAxis = this.vAxis;
                this.hAxisRenderer = new AxisRenderer();
                model.upperChartData.configureHAxisRenderer(this.hAxisRenderer);
                this.hAxisRenderer.axis = this.hAxis;        
                model.upperChartStyle.setHAxisRendererStyle(this.hAxisRenderer);
                this.myChart.horizontalAxisRenderers.push(this.hAxisRenderer);
                this.vAxisRenderer = new AxisRenderer();
                model.upperChartData.configureVAxisRenderer(this.vAxisRenderer);
                this.vAxisRenderer.axis = this.vAxis;
                model.upperChartStyle.setVAxisRendererStyle(this.vAxisRenderer);
                this.myChart.verticalAxisRenderers.push(this.vAxisRenderer);
                model.upperChartStyle.setVAxisDataLabelStyle(this.vAxisMinLabel);
                this.addChild(this.vAxisMinLabel);   
                model.upperChartStyle.setSeriesStyle(model.upperChartData.series, model.upperChartData.shares);           
                this.myChart.dataProvider = model.upperChartData.dataProvider;
                this.myChart.series = model.upperChartData.series;
    The data for dataprovider and series you can see in attached file dataprovider.xml.
    xfield is equivalent to timestamp
    yfield is equivalent to absolute
    I think the problem could be the configuration of the datetimeaxis. The following method shows the parameter for the datetimeaxis:
            public function configureHAxis(axis:MyDateTimeAxis):void
                axis.parseFunction = UtilityClass.parseYYYYMMDDHHNNSSString2Date;
                axis.dataUnits = "days";
                axis.dataInterval = 1;
                axis.title = "";
                axis.minimum = new Date(UtilityClass.parseYYYYMMDDHHNNSSString2Date("2009-01-07 00:00:00").time);
                axis.maximum = new Date(UtilityClass.parseYYYYMMDDHHNNSSString2Date("2009-07-06 00:00:00").time);
    And finally you get the function, that I'm using for string to date conversion:
            public static function parseYYYYMMDDHHNNSSString2Date(input:String):Date
                var result:Date = new Date();
                var year:Number = Number(input.substring(0,4));
                var month:Number = Number(input.substring(5,7));
                var date:Number = Number(input.substring(8,10));
                var hours:Number = Number(input.substring(11,13));
                var minutes:Number = Number(input.substring(14,16));
                var seconds:Number = Number(input.substring(17,19));           
                result.setUTCFullYear(year);
                result.setUTCMonth(month-1);
                result.setUTCDate(date);
                result.setUTCHours(hours);
                result.setUTCMinutes(minutes);
                result.setUTCSeconds(seconds);
                return result;           
    I hope that will help to locate the reason for the wrong chart visualization.
    Thanks for any help.

  • I have a problem with a chart refreshing after its bound data provider changes.

    I have a problem with a chart refreshing after its bound data
    provider changes. After the subsetHighLowData.refresh() is called I
    would expect the chart to redraw, but it still looks the same. I
    even inspected the debugger to see if the slice had taken place and
    it had.
    Any ideas coding friends?

    "nikos101" <[email protected]> wrote in
    message
    news:gib6aa$prr$[email protected]..
    >I have a problem with a chart refreshing after its bound
    data provider
    >changes.
    > After the subsetHighLowData.refresh() is called I would
    expect the chart
    > to
    > redraw, but it still looks the same. I even inspected
    the debugger to see
    > if
    > the slice had taken place and it had.
    >
    > Any ideas coding friends?
    >
    > subsetHighLowData.source =
    >
    highLowData.source.slice(slider.values[0],slider.values[1]);
    Just use the ArrayCollection's removeItemAt, and it should
    handle the event
    dispatching for you.
    HTH;
    Amy

  • Problem with waveform chart: time scale does not show time correctly

    Hello,
    I have some problems with a chart.
    I want to display some data and the time between two single data can vary. It is something between 50ms and 500 ms.
    The problems I have:
    1. The time is not shown correctly in the chart (allways 2:00:10 instead of the current time)
    2. the data points in the chart have a distance of 1 s (x-scale). That is not correct.
    I have tried several things but I thinkt I am on the wrong track.
    Could you please help me?
    Johannes
    LabVIEW 7.1 (!)
    Message Edited by johanneshoer on 10-14-2009 04:26 AM
    Greetings Johannes
    Using LabVIEW 7.1 and 2009 recently
    Solved!
    Go to Solution.
    Attachments:
    Chart Test.vi ‏55 KB

    I have modifierd the vi again.
    Now it looks much better.
    I have a data array and the last 10 seconds of the data are displayed.
    The array size is maximum 150 and that is more than I need to display. If new data is inserted, the oldest gets deleted.
    I wonder if this style is efficient?
    The time is stil not displayed correctly in the graph. Why does it always show 2:00:00 ?
    Johanens
    LabVIEW 7.1
    Greetings Johannes
    Using LabVIEW 7.1 and 2009 recently
    Attachments:
    Chart Test 3.vi ‏57 KB

  • PROBLEM WITH OVERLAID CHART

    Hello everyone, I'm using flex 2 and I have an application
    that shows a ColumnChart to the user, and let the user choose the
    chart type, that can be overlaid, clustered, 100% or stacked... And
    I'm having problem with the overlaid type, because in the chart
    I've put 4 ColumnSeries, and when the chart is rendered, some of
    the columns appear in front of the other ones hidding it...
    It doesn't solve my problem to change the order of the column
    series because the order of the bars will change for all the
    items...
    What should I do to have the overlaid chart working
    perfectly, showing all the columns correctly?
    Thanks in advance.

    Seems to simply be a problem with your data. See this
    code.

  • Problem with Bar Chart using Date Data

    I am trying to make a simple horizontal bar chart as a Gantt chart.  I am trying to set the min and max for the X axis but it is acting strangely. As you can see in the screenshot below, I set the min to 1/1/2000 but the chart uses 9/28/2011.  Similar problem with the max setting.  Am I doing something wrong here? Can anyone duplicate this? Anyone have a solution other than this workaround I am now using (which I assume will break my chart once Apple fixes this problem)?

    BadUnit,
    I assume Numbers, like me, is confused why you would set min/max limits that do not include the data?
    I do get the same result as you when I enter the time range for the chart as 1/1/2000 thru 1/1/2004.
    I even tried making a separate table for the chart:
    There is definitley a problem.
    When I enter, what I think are reasonable,  min and max dates for the chart
    min = 1/1/2013
    max = 12/31/2015
    The chart adjusts like this:

  • Problem with Waveform Chart updating

    Hi!
    I have written a LabVIEW project for 8510.
    I have a problem with the waveform chart not updating the data incoming to it.
    that is, Y axis does not update according to 8510 display format.
    May you help me?
    Attachments:
    Network_Analyzer_8510C_nazanin_5.lvproj ‏6 KB

    Hi,
    Do you want to change the label???
    1. Just right clicl your graph
    2. in the properties window go to 'Scales' tab
    3. select the Axis, and change the name.
    Is this the solution regarding your issue....
    Or
    do you want to change the domain from Time or Frequency...??
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.
    Attachments:
    Solution.vi ‏265 KB

  • Problem with Pie Chart

    Hi Experts!!
    I've a little problem with a Pie Chart, I want to present a Pie Chart with 3 values which are defined on the Data Series, when I deploy I get the message: "Expected exactly 1 data series in XXXXX chart. Extra data series ignored". I don't understand why, because if I try to do a Column Chart with the same information, it works Ok!
    Can anybody help me please?.
    Emilio.

    Multiple data series with Pie Chart is not possible. you must have one series if u r using pie chart

  • Problem with linear chart

    Hello.
    After two days tray to solve problem, I need your help.
    I have problem with presentation some data. Data growning aproxx. linear. I read this data from device. Sometime my .vi not successful read data and in this case my chart have sags to zero (see on picture)
    http://prntscr.com/6yq9y2
    How I can make chart :  if not succesfull read data use previous value to show on the graph? In this case I not have big sags to zero.
    Pls help.
    Solved!
    Go to Solution.

    Hi Qooler,
    easy solution: when you don't want those zeros in your chart you shouldn't put them into the chart plot!
    if not succesfull read data use previous value to show on the graph?
    Some pseudocode:
    new value := readDAQ()
    IF error on reading new data THEN
    new value := old value
    ENDIF
    plot(new value)
    old value := new value
    Please attach images/VIs/files directly in the forum using the attachment button right below the message edit box. Using 3rd party websites will just lead to problems when accessing this website from behind (company) firewalls!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Problem with waveform chart

    Hello friends.
    I'm in learning lab view and have some questions.
    I get a signal with an Analog to Digital converter (an Atmega 32) and send data to com port .
    I convert my data to real value in voltage and time .
    But i have problem with show wave form in different frequency .
    By Increase of frequency , waveform chart can not draw my data Clearly.
    What i do to show data in different frequency ?
    Thanks .
    Attachments:
    t4.vi ‏13 KB

    Interfacing with hardware is seldom easy. That is why I lean toward NI stuff since they have made there stuff resonably simple and they have good supprt.
    When interfacing with hardware from others, we have to look fo rthe manufacuer of the hardware to provide enough support to get started.
    So I suggest you contact whoever makes your device and get some examples from them.
    Hopefully they have heard of LV and have drivers.
    Otherwise, ther is no guarentee it will be possible.
    If English is not your primary language, plese feel free to post in both English and your native language. We have contributors that can handle most languages so do not let English get in the way.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Problem with bar chart and conditionals

    Hi Experts!
    I have a problem doing a chart
    My chart is horizontal barchart...and Axis Y there is some accounts of a dimension...
    There is two kind of accounts...when value is > 0 then green and < 0 then red and other kind is > 0 red and < 0 green... so each bar is an account but depends of each account it will be green or red. In tables I can do it with conditional format depends of other column...but I can't do it with a chart.
    Is possible to do this?
    Thanks!!!
    I add a picture with my problem: http://imageshack.us/photo/my-images/849/barchart.jpg/

    Hi,
    In 11g in graph properties in the second tab(STYLE)-->Graph Data ..Style and Conditional Formatting-->Conditional Formatting .
    You can see all the columns used.
    You can select the column and specify the filter condition and select the color for the graph.
    You can select for which column you need to have the conditional formatting.
    Regards
    MuRam

  • Problems with line chart rendering

    Hi.
    I have some problems with a line chart with 2 series.
    I have the folowing series:
    SELECT null link, t.column_value eticheta, EVM_REPORT.ACTUAL_COST2(:P37_PROJECTID, t.column_value) valoare
    FROM TABLE(utils.table_for_iteration(
    to_date('2007-05-20', 'yyyy-mm-dd'), sysdate)) t
    SELECT null link, t.column_value eticheta, 7 valoare
    FROM TABLE(utils.table_for_iteration(
    to_date('2007-05-20', 'yyyy-mm-dd'), sysdate)) t
    function table_for_iteration(param_start in date,param_end in date) return DATE_ARRAY PIPELINED AS
    BEGIN
    FOR i IN 0 .. (param_end - param_start)
    LOOP
    PIPE ROW(param_start + i);
    END LOOP;
    RETURN;
    END table_for_iteration;
    FUNCTION actual_cost2(in_project_id in number, end_date IN DATE) RETURN number AS
    begin
    return 2;
    end actual_cost2;
    The chart does not display (at all). If i replace EVM_REPORT.ACTUAL_COST2(:P37_PROJECTID, t.column_value) with some value, it displays.
    Any ideea ?

    Hi,
    Do you mean point the partial trigger to the surrounding container? I have tried that but it makes no difference. I am almost certain that the problem is associated with the forEach component as if I have exactly the same structure but without the forEach then the ppr works fine.
    Thanks for your help on this,
    Dave

Maybe you are looking for