Jump to content
Software FX Community

beltrams

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by beltrams

  1. Can someone please help on this? Many thanks!
  2. Hi JuanC, Here how I ahve soleved the problem, I hope this will help others in the futute: I have an attached property on cfx:Chart binfing to my data source, every time I update the data source I call Chart.ConditonalAttributes.Recalculate. This make the trick and works fie (for my case): public static class ConditionalAttributesFix { #region Fix on ItemsSource change /// <summary> /// Gets the attached dependency property used to apply the fix /// </summary> public static readonly DependencyProperty OnItemsSourceChangeProperty = DependencyProperty.RegisterAttached( "OnItemsSourceChange", typeof(IEnumerable), typeof(ConditionalAttributesFix), new UIPropertyMetadata(null, OnOnItemsSourceChangePropertyChanged) ); /// <summary> /// Gets the attached dependency property value used to apply the fix /// </summary> public static IEnumerable GetOnItemsSourceChange(DependencyObject obj) { Contract.Requires(obj != null); var obj_tmp = obj.GetValue(OnItemsSourceChangeProperty); if (obj_tmp == null) throw new InvalidOperationException("Dependency object value must not be null"); return (IEnumerable)obj_tmp; } /// <summary> /// Sets the attached dependency property value used to apply fix /// </summary> public static void SetOnItemsSourceChange(DependencyObject obj, IEnumerable value) { Contract.Requires(obj != null); obj.SetValue(OnItemsSourceChangeProperty, value); } static void OnOnItemsSourceChangePropertyChanged(DependencyObject dpo, DependencyPropertyChangedEventArgs args) { if (dpo == null) return; Chart el = dpo as Chart; if (el == null) throw new InvalidCastException("Object of type \"Chart\" expected"); if (args.NewValue != null) { el.ConditionalAttributes.Recalculate(); } } #endregion }} Cheers.
  3. I think this will helps! Regards.
  4. Hi JuanC, I have found an hack that, at least for me, works: I attach the following attached property to the textbox I use as template for the PointLabeAttribute: public static class DataLabelPositionFixForGantt { /// <summary> /// Gets the attached dependency property used to apply the overridden position /// </summary> public static readonly DependencyProperty ChartTypeProperty = DependencyProperty.RegisterAttached( "ChartType", typeof(string), typeof(DataLabelPositionFixForGantt), new UIPropertyMetadata(string.Empty, OnChartTypePropertyChanged) ); /// <summary> /// Gets the attached dependency property value used to apply overridden position /// </summary> public static string GetChartType(DependencyObject obj) { Contract.Requires(obj != null); var obj_tmp = obj.GetValue(ChartTypeProperty); if (obj_tmp == null) throw new InvalidOperationException("Dependency object value must not be null"); return (string)obj_tmp; } /// <summary> /// Sets the attached dependency property value used to apply red condition /// </summary> public static void SetChartType(DependencyObject obj, string value) { Contract.Requires(obj != null); obj.SetValue(ChartTypeProperty, value); } static void OnChartTypePropertyChanged(DependencyObject dpo, DependencyPropertyChangedEventArgs args) { if (dpo == null) return; TextBlock el = dpo as TextBlock; if (el == null) throw new InvalidCastException("Object of type \"TextBlock\" expected"); if (args.NewValue is string == false) return; if ((string)args.NewValue == WidgetTypes.Gantt.Code) { var cont = el.FindVisualParent<ContentPresenter>(); if (cont == null) throw new InvalidCastException("Object of type \"ContentPresenter\" expected"); var pn = new PropertyChangeNotifier(cont, Canvas.LeftProperty); pn.ValueChanged += OnCanvasLeftChanged; cont.Loaded += OnLoaded; } else { var cont = el.FindVisualParent<ContentPresenter>(); if (cont == null) throw new InvalidCastException("Object of type \"ContentPresenter\" expected"); var pn = new PropertyChangeNotifier(cont, Canvas.LeftProperty); pn.ValueChanged -= OnCanvasLeftChanged; cont.Loaded -= OnLoaded; } } static void OnCanvasLeftChanged(object sender, EventArgs e) { PropertyChangeNotifier notifier = sender as PropertyChangeNotifier; if (notifier == null) throw new InvalidCastException("Object of type \"PropertyChangeNotifier\" expected"); UIElement el = notifier.PropertySource as UIElement; if (el == null) throw new InvalidCastException("Object of type \"UIElement\" expected"); if (Canvas.GetLeft(el) < 9) Canvas.SetLeft(el, 9); } static void OnLoaded(object sender, EventArgs e) { UIElement el = sender as UIElement; if (el == null) throw new InvalidCastException("Object of type \"UIElement\" expected"); if (Canvas.GetLeft(el) < 9) Canvas.SetLeft(el, 9); } }} I hope this will help others in the future. Cheers!
  5. Dear Forum, I have the followong settings for a Gantt chart: Anchor="Center" HorizontalAlignment="Center" VerticalAlignment="Center" As result I have the attached screenshot. As you can see, labels for small Gantt bars are cutted, they should be 8, 16 and 46 but you cannot read it. I have tried setting the offset but I doesnt work, does it work with Gantt? Anything I can do?
  6. Hello JuanC, I would like to 1) set the decimals I want to see on the point label (not the axis, the point in the plottable area), ideally with binding to my chart point (which is a class with Y and X + other stuff). 2) set the text to be vertical for bars (I have raised a separate forum discussion for this). Thanks, Simone
  7. Dear Forum, Is it possible to have vertical point labels on each bar in the bar chart? Thanks!
  8. Dear Forum, Any way I can format the PointLabelAttribute? I have tried settings PointLabelAttribute.Template to a textbox, it works but I lose the labels on 3D bars. Ideally I would like to bind the format to the point in my view model but I can set it in XAML if it is not possible. Many thanks.
  9. Dear Forum, If a pie chart has different axis/series one of the option is show small pies i tumbnail and the user can select which one to see. Is it possible to style the thumbnail to show the name only (no small pie) and maybe to add a vertical scrollbar to that so i can scroll the items? thanks, Simone
  10. Dear Forum, Is it posible to create a Pie chart but with a missing slice? basically an uncompleted pie... Many thanks, Simone
  11. Dear Support forum, I have a chart where I use binding for both Chart Gallery and ItemsSource. Chaging the type from Pie to Bar I get the following exception, please note that this is only changing from Pie to something else and not viceversa. After the exception (if I catch it) I see the chart rendered correctly (it looks like at least). Unable to cast object of type 'o' to type 'l'. Error Stack: at ChartFX.WPF.Data.CrosstabTransform.n.a(Object A_0)at ChartFX.WPF.Internal.ColumnGetter.GetString(Object obj)at ChartFX.WPF.AxisLabelAttributes.a(DataGetter& A_0, ILabelCollection A_1, Int32 A_2, Object A_3, Type A_4, NotifyCollectionChangedAction A_5)at ChartFX.WPF.AxisLabelAttributes.a(Int32 A_0, Object A_1, Type A_2, NotifyCollectionChangedAction A_3)at ChartFX.WPF.Axis.a(Int32 A_0, Object A_1, Type A_2, NotifyCollectionChangedAction A_3)at ChartFX.WPF.Axis.e(Boolean A_0)at ChartFX.WPF.Chart.y()at ChartFX.WPF.Chart.MeasureOverride(Size constraint)at System.Windows.FrameworkElement.MeasureCore(Size availableSize)at System.Windows.UIElement.Measure(Size availableSize)at System.Windows.ContextLayoutManager.UpdateLayout()at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) Any help please? I am on chart fx for wpf 8.0.4247.25815. Thanks!
  12. Oh... Many thanks JuanC... I havent noticed that grey line before... Please, can I apply those solution in xaml? I don't have code behind... Many thanks again!
  13. Hi JuanC, here a part of our code on how we do this: XAML: <Cfx:Chart x:Name="WidgetChart" ItemsSource="{Binding Path=ReportData, Mode=OneWay}"> C#:public IList<ChartableReportRow> ReportData { get { return _reportData; } private set { _reportData = value; NotifyPropertyChanged(() => this.ReportData); } } and to set it I do: this.ReportData = new Collection<ChartableReportRow>( (from row in reportList select new ChartableReportRow(row)).ToList() ); so it should be a new IList every time...
  14. Thanks JuanC, Where can I get this hotfix?
  15. Hello JuanC, I don't understand 100% what you are saying, at the moment I have a gridline and on the Y axis I have 10, 20, 30, 40. The bar doesn't reach the 40. HOw do I create this custom gridline? Please see the screenshoot: https://docs.google.com/open?id=0B6Y2SBg7Gy6cTk42eGRETFAzSGs
  16. Dear Forum, I have a bar bart with ConditionalAttributes to show negative bars in red. When I hover over a positive bar with the mouse (where I dont have any Conditional Attributes) this stay coloured while all the other bars are grayed out as expected. If I do the same on a negative bar, all the negative bar (so those with Conditional Attributes) stays coloured and only positive bars are grey. Is this a bug? Thanks!
  17. Dear Forum, i have a Bar (gantt) chart with conditional attributes to show negative bars in red. This works fine but when I update my data even if the bar are updates (for example one bar became from negative to positive) the conditional colours are not reapplied so it stays red even if it is positive. Any idea about this? is this a bug? Thanks!
  18. Dear Forum, I have a simple bar chart with 2 bars Y values 10 and 40. The 10 bar is rendered correctly, so that it exactly has the top on 10, but the 40 fall short: its top it is a bit under the 40 mark. In general this happens always: the tollest bar it is always a bit shorter than it shoud. Any idea on this? Thanks!
  19. Is it possible to do something symilar with binding? I have tried a multibinding <MultiBinding Converter="{StaticResource MinAndMaxConverter}"> <Binding Mode="OneWay" ElementName="test1" Path="Min" /> <Binding Mode="OneWay" ElementName="test1" Path="Max" /> </MultiBinding> but it seems to be Min and Max don't notify as the converter is called only once (with double.minvalue/maxvalue). Otherwise, as I dont have code behind, I will need to use an attached behaiour
  20. Dear Forum, I have a line chart where I set ForceZero to False so that the chart is in all the plot area. This was working ok for me bbut know, I have a problem for a particular set of data. The value of the chart are in this case vary close, for example : 14.945, 14.95, 14.954, 14.965 etc. The chart is diplayed correctly but I have no clue on the Y axis about the values (see screenshoot 1). I have tried to set the Step to 0.01, this do the trick for this particular data (see screenshoot 2) but it is not accettable for other data (for example if I have value range between 0 and 100!). Do you have any suggestion on this? Id it is possible to show always min and max or some line or something else to give a blue about the values? Thanks for any hint on this. Simone
  21. Dear forum, Please see the attaced demo application. When the chart load, I have No data available message as I have a new emtry list. The first button load some data which is correctly displayed. The second button load again an empty list, same as the first load, but instead a No data available message I have an empty chart with the old value in the X axis and Y axis. I am using no code behind, MVVM. Am I doing something wrong? Is there a way to display again the message or is it a bug in the binding? Thanks, Simone
  22. This is now ok, the error was on my side. Thanks.
  23. This can actually be somethng with the style in my application. I am investigating more.
×
×
  • Create New...