Jump to content
Software FX Community

Bug with labels on y-axis?


srickenb
 Share

Recommended Posts

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? 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 });

  }

===> 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; }

  }

Link to comment
Share on other sites

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)

{

....

}

 
Link to comment
Share on other sites

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)

{

....

}

 
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...