Jump to content
Software FX Community


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by kelias

  1. I'm binding my grid to hourly data, but when I show the DataView I just see the values and not the hours. Is there a way to add a column heading bound to the DateTime (X Axis on my chart)?
  2. I would like to build a chart with two series. One a bar the other a step. When I try this the chart only shows the step and not the bars. I can display both individually but not together. Here is the code: chtMain.Series.Clear(); chtMain.AxesY.Clear(); Axis a = new Axis {AutoScale = true, ForceZero = false, Labels = {Decimals = 2}, Title = new Title("value")}; chtMain.AxesY.Add(a); chtMain.AxisX.Labels.Format = AxisFormat.Time; chtMain.AxisX.Labels.CustomFormat = "HH:mm"; chtMain.AxisX.Title = new Title("Time"); SeriesAttributes series = new SeriesAttributes("Value"); series
  3. The XAML: <Window x:Class="ChartfxTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cfx="http://schemas.softwarefx.com/chartfx/wpf/80" xmlns:cfxmotifs="http://schemas.softwarefx.com/chartfx/wpf/80/motifs" Title="MainWindow" Height="350" Width="525"> <Grid> <cfx:Chart x:Name="chtMain" Gallery="Line" UseEffects="True" UseVisuals="True" BorderThickness="0" Style="{x:Static cfxmotifs:Basic.Style}" Border="{x:Static cfx:Borders.None}" >
  4. Your example doesn't even include time. I'm doing all this in code instead of XAML. Here is an example chtMain.AxisX.Labels.Format = AxisFormat.DateTime; chtMain.AxisX.Labels.CustomFormat = "HH:mm"; When I do this the time is shown but it's still in a 12 hour clock, and then it also looses the ability to change depending on the size of the chart. So if I have 1000 data-points, it then puts a label for each data point instead of only those that fit.
  5. When I do this: chtMain.AxisX.Labels.CustomFormat = "HH:mm:ss"; I it just prints the letters and doesn't actually format the data. ie: for 23:21 I get "HH:mm:ss" instead.
  6. I know I can set the X Axis to a Date Time format like so: AxisX.Labels.Format = AxisFormat.DateTime; But is there a way to make it use a 24 hour clock on the time instead? I tried using AxisX.Labels.CustomFormat But I'm not sure how to format the string I pass into it to get the desired result.
  7. I would like the grid lines in the main area of a chart to be a different color then the color of the tick marks at the bottom of the chart. Is there a way to do this? A vertical gradient is the only way I can think of currently, but it seems like a hack.
  8. Nevermind got it working. Heres what I did: In the XAML I added two annotations for the horizontal and vertical lines. (note the binding, to span to the size of the container) <cfx:Chart.Extensions> <cfxAnnotation:Annotations x:Name="annotations"> <Line x:Name="lineH" Visibility="Visible" Fill="Black" Stroke="Black" X1="0" X2="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Canvas}},Path=Width}" /> <Line x:Name="lineV" Visibility="Visible" Fill="Black" Stroke="Black" Y1="0" Y2="{Binding RelativeSource={RelativeSource FindAn
  9. When the user moves the mouse over the chart I would like a crosshair to appear and track with the mouse. (vertical and horizonal line that intersect at the current mouse location) This should only be on the chart portion and not on the legend or titles etc.. I assume I would use annotation's to accomplish this? Do you have a sample of this anywhere? Thanks,
  10. If you use the example above and bind the collection to the chart instead of the series it doesn't seem to resize correctly. When an item is added it refreshes properly but when I remove an item the chart does not scale the x axis correctly reclaiming the space. But it does work if you assign it to each series instead. (Let me know if I'm missing something here.) Our charts use the X axis as a time, and the datapoints are not equally spaced.
  11. I have a chart that I want to appear to scroll so it only shows a certain number of data points. I have the chart bound to an ObservableCollection, so when I get an item to add to the collection I remove the first item from the collection. This works fine except with Zoom. When I zoom and data comes in the chart throws a NullReferenceException. (I have the full stacktrace at the bottom) Here is some code to reproduce the problem: using System; using System.Collections.ObjectModel; using System.ComponentModel; using System.Windows; using ChartFX.WPF; namespace ChartTest3 {
  12. kelias

    Zoom Problem

    When I attempt to zoom a chart I'm getting an exception being thrown by ChartFx: ArgumentOutOfRangeException. I have a basic chart, and I add a Line series that uses Dates as the X axis. Then I bind to an observablecollection that has the data points. The chart displays fine but when I click on button2 to do a zoom I get the error. Any ideas why this is happening? private void button2_Click(object sender, RoutedEventArgs e) { chart1.Zoom.Mode = ZoomMode.Selection; } private void NormalLineChart() { chart1
  13. I'm using a line chart and the data is time series so the X is set to dates.
  14. I'm trying to implement behaviour similiar to google finance where a user moves the mouse over a chart and it tracks on each series and displays the values for each series on the top of the chart. I can use the HitTest method of the chart in the MouseMove event to determine when the user is in the Plot Area, but I can't find a nice way to determine what the value of each series should be. Is there a simple way to take a Point object and determine what value for each series would match with it?
  15. kelias

    How to use Zoom?

    Nevermind I got it. Just ChartControl.Zoom.Mode = ZoomMode.Off; Could have swore I did that earlier.
  16. kelias

    How to use Zoom?

    How do I zoom back out again? I'm setting the chart zoom to selected, and it works fine, but I can't seem to see a nice way to zoom back out again.
  17. kelias

    How to use Zoom?

    Nice, works like a charm. Thanks!
  18. kelias

    How to use Zoom?

    Any idea why I can't seem to move the magnifier? It doesn't seem to respond at all to the mouse. I've tried left-clicking and dragging, I've right-clicked and tried dragging etc.. but nothing.
  19. I've added CustomGridLines to my application to do Fib retracements, but when I add a title to the CustomGridLine it appears in the Legend box. Is there a way to prevent this from happening?
  20. kelias

    Movable Series?

    <p> Do you have an example of using Annotations in the code behind? I haven't been able to find one. I'm trying this but it's not working. </p> <pre> Rectangle r = new Rectangle();r.Width = 80; r.Height = 20; r.Fill = new SolidColorBrush(Colors.Blue); Annotations an = new Annotations(); an.Children.Add®; Annotations.SetAttachX(r, 10);Annotations.SetAttachY(r, 10); chart1.Extensions.Add(an); </pre>
  21. kelias

    How to use Zoom?

    Just need to call this method: private void NormalLineChart() { Axis a = new Axis(); a.Min = 0; a.Max = 50; chart1.AxesY.Add(a); List dps = LoadRandomDateTimeData(10,0,50,10); SeriesAttributes series = new SeriesAttributes("What"); series.BindingPathX = "When"; series.Gallery = Gallery.Line; series.ItemsSource = dps; series.AxisY = a; series.Marker.Visibility = Visibility.Collapsed; series.StrokeThickness
  22. kelias

    Movable Series?

    The users of my charting application have asked for the ability to do basic trend-lines. They need horizontal trend lines. I can add a series to mimic a trend-line but I'm not sure if it's possible to let them move the series through a drag like operation. Any ideas if this is possible?
  23. I have tried to turn on the zoom feature and I can get the magnifier to appear but it doesn't seem to respond to mouse input. I can't drag it or move it around at all. What am I missing? I'm doing this: chart1.Zoom.Mode = ZoomMode.Magnifier;
  • Create New...