in

Software FX Community

Discuss and find help for Chart FX, Grid FX and PowerGadgets products.

Bug with labels on y-axis?

Last post 07-16-2008 8:08 AM by srickenb. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 07-04-2008 8:44 AM

    Bug with labels on y-axis?

    The graph and gridlines often don't match with the labels on the y-axis. This seems to be dependent on the values and  once a zoom and un-zoom of the whole application window is done the chart mostly gets redrawn without the problem.

    The problem exist with line and bar charts. Is there a workaround for this? 

    Filed under: , , ,
  • 07-04-2008 4:16 PM In reply to

    • JuanC
    • Top 10 Contributor
    • Joined on 03-02-2007

    Re: Bug with labels on y-axis?

    Can you please send us a sample app that duplicates this issue? If this is not possible, please send us details about the settings applied to the chart (both XAML and code) as well as the data that seems to trigger this behavior.

    Regards,

    JuanC

  • 07-08-2008 3:48 AM In reply to

    Re: Bug with labels on y-axis?

    Thanks for answering so quickly.

    Please find further down the code I use. An interesting point: if I do a refresh at the end of the data assignment in the presenter class then the chart gets drawn without the problem :  View.fxVamiChart.Refresh();

       

        <UserControl.Resources>

           ...
           <report:FXchartSeries x:Key="vamiChartData"/>
        </UserControl.Resources>
      
           ... 

                <ChartFX:Chart  Name ="fxVamiChart" Grid.Row="0" Grid.Column="0"  Width="500" Height="340" ItemsSource="{Binding Source={StaticResource vamiChartData}}" Gallery="Line">

     

                    <ChartFX:Chart.Titles>
                        <ChartFX:Title  FontSize="16" Foreground="Black">value added monthly index (VAMI)</ChartFX:Title>
                    </ChartFX:Chart.Titles>

                    <ChartFX:Chart.AxisY>
                        <ChartFX:Axis  Title="" >

                            <ChartFX:Axis.Grids>
                                <ChartFX:Grids Minor="{x:Null}">
                                    <ChartFX:Grids.Major>
                                        <ChartFX:GridLine Stroke="LightGray"  Visibility="Visible"/>
                                    </ChartFX:Grids.Major>
                                </ChartFX:Grids>
                            </ChartFX:Axis.Grids>

                        </ChartFX:Axis>
                    </ChartFX:Chart.AxisY>
                    <ChartFX:Chart.Series>
                        <ChartFX:SeriesAttributes ToolTips="{x:Null}" BindingPath="Val" >
                            <ChartFX:SeriesAttributes.Marker>
                                <ChartFX:MarkerAttributes Stroke="{x:Null}" Visibility="Hidden" />
                            </ChartFX:SeriesAttributes.Marker>
                        </ChartFX:SeriesAttributes>
                    </ChartFX:Chart.Series>


                    <ChartFX:Chart.AxisX>
                        <ChartFX:Axis Title="Time">

                            <ChartFX:Axis.Grids>
                                <ChartFX:Grids Minor="{x:Null}" >
                                    <ChartFX:Grids.Major>
                                        <ChartFX:GridLine Stroke="LightGray"  Visibility="Hidden" />
                                    </ChartFX:Grids.Major>
                                </ChartFX:Grids>
                            </ChartFX:Axis.Grids>

                            <ChartFX:Axis.Labels>
                                <ChartFX:AxisLabelAttributes BindingPath="Cat"  Angle="90" />
                            </ChartFX:Axis.Labels>

                        </ChartFX:Axis>
                    </ChartFX:Chart.AxisX>

                </ChartFX:Chart>

     

     

    ===> In the code-behind class (View)

            public FXchartSeries ChartVAMI { get { return (FXchartSeries)this.FindResource("vamiChartData"); } }

     


    ===> In the presenter class


                        View.ChartVAMI.Clear();
                        View.ChartVAMI.Add(new Reporting.Point { Cat = dates[0].ToString("MMM yy"), Val = 100 });

                        for (int i = 0; i < performance.Index.Length; i++)
                        {
                            View.ChartVAMI.Add(new Reporting.Point { Cat = dates[i + 1].ToString("MMM yy"), Val = 100 * performance.Index[i] });
                        }

    ===> The Reporting.Point class

     

        public class Point
        {
            public double Val { get; set; }
            public string Cat { get; set; }
            public string Tx { get; set; }
            public double X { get; set; }
            public DateTime Time { get; set; }
        }

  • 07-09-2008 5:15 PM In reply to

    • JuanC
    • Top 10 Contributor
    • Joined on 03-02-2007

    Re: Bug with labels on y-axis?

    Can you tell use when is the code that adds the data points being executed? Do you run in on the Loaded event for your Window? In a button? In a separate thread?

    Regards,

    JuanC

  • 07-16-2008 8:08 AM In reply to

    Re: Bug with labels on y-axis?

    It's getting a bit difficult now. I use the Smart Client framework WPFCAB - a full  port of CAB to WPF and update several charts in an event subscription. The thread which does the work is the user interface thread.

     As to how CAB does all the event mapping to .net I cannot say.

     Kind regards,

    Stefan

     

    ==> The event gets fired :

    public void updateQuant()

    {

      if (IsReadyForQuant)

      {

          WorkItem.RootWorkItem.EventTopics[BusinessEntities.Constants.PortfolioQuantChanged].Fire(

         this,   new EventArgs<FinancePortfolio>(this),    null, PublicationScope.Global);

      }

    }

    ==> and triggers a couple of charts to be redrawn with new data:

    [EventSubscription(BusinessEntities.Constants.PortfolioQuantChanged, ThreadOption.UserInterface)]public void drawReturnChart(object sender, EventArgs<FinancePortfolio> portfolio)

    {

     ....

    }

    [EventSubscription(BusinessEntities.Constants.PortfolioQuantChanged, ThreadOption.UserInterface)]public void drawNAVChart(object sender, EventArgs<FinancePortfolio> portfolio)

    {

    ....

    }


     

  • 07-16-2008 8:08 AM In reply to

    Re: Bug with labels on y-axis?

    It's getting a bit difficult now. I use the Smart Client framework WPFCAB - a full  port of CAB to WPF and update several charts in an event subscription. The thread which does the work is the user interface thread.

     As to how CAB does all the event mapping to .net I cannot say.

     Kind regards,

    Stefan

     

    ==> The event gets fired :

    public void updateQuant()

    {

      if (IsReadyForQuant)

      {

          WorkItem.RootWorkItem.EventTopics[BusinessEntities.Constants.PortfolioQuantChanged].Fire(

         this,   new EventArgs<FinancePortfolio>(this),    null, PublicationScope.Global);

      }

    }

    ==> and triggers a couple of charts to be redrawn with new data:

    [EventSubscription(BusinessEntities.Constants.PortfolioQuantChanged, ThreadOption.UserInterface)]public void drawReturnChart(object sender, EventArgs<FinancePortfolio> portfolio)

    {

     ....

    }

    [EventSubscription(BusinessEntities.Constants.PortfolioQuantChanged, ThreadOption.UserInterface)]public void drawNAVChart(object sender, EventArgs<FinancePortfolio> portfolio)

    {

    ....

    }


     

Page 1 of 1 (6 items)
Copyright 2008 Software FX, Inc.