Jump to content
Software FX Community

JuanC

Staff
  • Posts

    863
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by JuanC

  1. There is a check in our code that will prevent you from templating axis labels when you are not using Chart.ItemsSource, if this was only for testing wrapping in the current build you will have to create a collection of simple CLR objects with 2 properties (one numeric to be plotted and a string property to use in the X axis) and use Chart.ItemsSource to populate the chart with it. We will support axis labels templating with manual data in future builds and your binding will be to either DataItem or Text, e.g. <TextBlock Text="{Binding Path=DataItem}"/>Regards, JuanC
  2. We have been able to duplicate 1 and 2 and are already working on fixes for this but we have not been able to duplicate problem #3. Can you try to generate this issue in a dummy app? There are also additional unresolved issues related to templated axis labels, particularly if you change axis properties after the axis has been rendered, we are also working on these. Regards, JuanC
  3. Both the hotfix and the auto-updater purpose is to modify files, which are typically under C:\Program Files so a restricted acount will not be able to perform these actions. They also modify some registry keys so even if you installed on a folder other than ProgramFiles you might have issues running these under a restricted account. You must run the hotfix or the browser as an Administrator to update your bits. Regards, JuanC
  4. A hotfix is now available that includes support for this new property. You can download our most recent hotfix here. Regards, JuanC
  5. JuanC

    scrollbar location

    You can achieve this in ChartFX for WPF but you have to make sure you use build 3434 or newer. You will have to create an extra X axis so that you have an axis with labels but not scrollbar and another with a scrollbar but no labels. Axis axisMain = chart1.AxisX;chart1.Series.Clear();chart1.Series.Add(new SeriesAttributes("Value")); Axis axisExtra = new Axis();axisExtra.Position = AxisPosition.Near;axisExtra.AxisStyle |= AxisStyles.Categorical;axisExtra.Labels.BindingPath = "Name";axisExtra.ScrollBar.Visibility = Visibility.Collapsed;chart1.AxesX.Add(axisExtra);axisMain.Labels.BindingPath = "Name";axisMain.Labels.Visibility = AxisLabelVisibility.Collapsed;axisMain.Position = AxisPosition.Far;axisMain.ScrollBar.Margin = new Thickness(-1, 0, 0, 0);axisMain.ScrollViewChanged += new EventHandler(OnScrollViewChanged);axisMain.Grids.Major.Visibility = Visibility.Collapsed;axisMain.Grids.Major.TickMark = TickMark.None;axisMain.Grids.Minor.Visibility = Visibility.Collapsed;axisMain.Grids.Minor.TickMark = TickMark.None; chart1.DataBound += new EventHandler(OnDataBound);private void OnDataBound (object sender, EventArgs e){ chart1.AxisX.SetScrollView(1, 5);} private void OnScrollViewChanged (object sender, EventArgs e){ Axis axisMain = chart1.AxesX[0]; Axis axisExtra = chart1.AxesX[1]; double min = Math.Truncate(axisMain.ScrollPosition); axisExtra.SetScrollView(min + 1, min + 5);}You can download our most recent hotfix here. Regards, JuanC
  6. We have uploaded a hotfix that includes support for this scenario. You can download a hotfix here. Regards, JuanC
  7. A hotfix is now available that includes support for this functionality. You can download a hotfix here. Regards, JuanC
  8. We have fixed this issue on build 3439. You can download a hotfix here, our next service pack should include these fixes. We apologize for the inconvenience. Regards, JuanC
  9. We have fixed this issue on build 3439, you do not have to call chart.Refresh You can download a hotfix here, our next service pack should include these fixes. Regards, JuanC
  10. The key here is that when you assign a DataTemplate to be used in the legend box for a series, you are actually binding against a CLR object that hold series information (as well as some global info), this is the same object that exposes a Dimmed property even though Series does not have that property but is NOT the series itself. We will fix this issue in future builds but as a workaround you can tweak your template to make sure you are binding to the Series.Visibility property, e.g. <CheckBox VerticalAlignment="Center" Background="{Binding Path=Fill}" IsChecked="{Binding Path=Series.Visibility, Converter={StaticResource VisibilityToBool}}" Grid.Column="0" Foreground="White" /> Regards, JuanC
  11. If you have a chart with multiple series and need to provide UI to show/hide series, you can use styling on the legend box items to display a checkbox for each series. [color= red]xmlns[/color][color= blue]:[/color][color= red]cfxConverters[/color][color= blue]="http://schemas.softwarefx.com/chartfx/wpf/80/converters"[/color] [color= blue]<[/color][color= #a31515]DataTemplate [/color][color= red]x[/color][color= blue]:[/color][color= red]Key[/color][color= blue]="CheckLegend"> <[/color][color= #a31515]DataTemplate.Resources[/color][color= blue]> <[/color][color= #a31515]cfxConverters[/color][color= blue]:[/color][color= #a31515]VisibilityToBooleanConverter [/color][color= red]x[/color][color= blue]:[/color][color= red]Key[/color][color= blue]="VisibilityToBool" [/color][color= red]FalseVisibility[/color][color= blue]="Hidden"/> </[/color][color= #a31515]DataTemplate.Resources[/color][color= blue]> <[/color][color= #a31515]Grid[/color][color= blue]> <[/color][color= #a31515]Grid.ColumnDefinitions[/color][color= blue]> <[/color][color= #a31515]ColumnDefinition [/color][color= red]Width[/color][color= blue]="Auto" /> <[/color][color= #a31515]ColumnDefinition [/color][color= red]Width[/color][color= blue]="Auto" /> <[/color][color= #a31515]ColumnDefinition [/color][color= red]Width[/color][color= blue]="*" /> </[/color][color= #a31515]Grid.ColumnDefinitions[/color][color= blue]> <[/color][color= #a31515]CheckBox [color= red]Margin[/color][color= blue]="2,0" [color= red]VerticalAlignment[/color][color= blue]="Center" [/color][/color][/color][color= red]IsChecked[/color][color= blue]="{[/color][color= #a31515]Binding [/color][color= red]Path[/color][color= blue]=Visibility, [/color][color= red]Converter[/color][color= blue]={[/color][color= #a31515]StaticResource [/color][color= red]VisibilityToBool[/color][color= blue]}}" [/color][color= blue]/> <[/color][color= #a31515]Rectangle [/color][color= red]Stroke[/color][color= blue]="{[/color][color= #a31515]Binding [/color][color= red]Path[/color][color= blue]=Stroke}" [/color][color= red]Fill[/color][color= blue]="{[/color][color= #a31515]Binding [/color][color= red]Path[/color][color= blue]=Fill}" [/color][color= red]Grid.Column[/color][color= blue]="1" [/color][color= red]Width[/color][color= blue]="12" [/color][color= red]Height[/color][color= blue]="12" [/color][color= red]VerticalAlignment[/color][color= blue]="Center" [/color][color= red]Margin[/color][color= blue]="2,0" /> <[/color][color= #a31515]TextBlock [/color][color= red]FontFamily[/color][color= blue]="{[/color][color= #a31515]Binding [/color][color= red]Path[/color][color= blue]=FontFamily}" [/color][color= red]FontSize[/color][color= blue]="{[/color][color= #a31515]Binding [/color][color= red]Path[/color][color= blue]=FontSize}" [/color][color= red]Text[/color][color= blue]="{[/color][color= #a31515]Binding [/color][color= red]Path[/color][color= blue]=Text}" [/color][color= red]Grid.Column[/color][color= blue]="2" [/color][color= red]VerticalAlignment[/color][color= blue]="Center" [/color][color= red]Margin[/color][color= blue]="2,0" /> </[/color][color= #a31515]Grid[/color][color= blue]></[/color][color= #a31515]DataTemplate[/color][color= blue]>[/color] Unfortunately templating items in the legend box has to be done in the code because of our API so we need to add the following line of code to our Window/Page Loaded event (we expect to support a XAML way to set these templates in future builds but you know what they say
  12. You are correct on the fact that PlotArea.MinSize is not used to restrict the space taken by the "tools" (DataView, LegendBox, etc.), unfortunately there are 2 panels involved 1) There is a sort of DockPanel that holds the DataView, LegendBox and AxisPanel 2) AxisPanel holds all the axes and the plotarea Currently PlotArea.MinSize is only handled in the AxisPanel so it will not prevent a tool to take up all the space. Because both DataView and LegendBox derive from Control you can set their Width/Height. In the case of DataView that is by default docked bottom, you can set its height to 100 pixels. Note that we will honor a height bigger than the required space so if the number of series is variable you will have to account for that. Regards, JuanC
  13. As you suspected the right way to accomplish this is using a template for the AxisX labels. We have fixed a minor issue in our internal build so that you can create triggers for both Highlighted and Dimmed. e.g. <DataTemplate x:Key="RichContentLegend"> <StackPanel Orientation="Horizontal" x:Name="stack"> <Image x:Name="BarImg" Source="{Binding Path=DataItem.Image}" Width="20" Height="40" /> <TextBlock x:Name="BarText" Text="{Binding Path=DataItem.Product}" VerticalAlignment="Center"/> </StackPanel> <DataTemplate.Triggers> <DataTrigger Binding="{Binding Path=Dimmed}"> <DataTrigger.Value> <sys:Boolean>True</sys:Boolean> </DataTrigger.Value> <Setter Property="Opacity" Value="0.25" TargetName="stack" /> </DataTrigger> </DataTemplate.Triggers></DataTemplate>About TextDecoration: Internally we use "low-level" rendering for our axes unless you change the template, once you are templating you can use TextDecorations, e.g. <DataTrigger Binding="{Binding Path=Highlighted}"> <DataTrigger.Value> <sys:Boolean>True</sys:Boolean> </DataTrigger.Value> <Setter Property="TextDecorations" Value="Underline" TargetName="BarText" /></DataTrigger>This should be available in our next hotfix. Regards, JuanC
  14. The reason why sometimes you might get a clipped axis is because there is a property (PlotArea.MinSize) that assigns a minimum percentage of the available space to the plotarea. If you would rather have the axis unclipped you can use the following XAML <cfx:Chart.PlotArea> <cfx:PlotAreaAttributes MinSize="0"/></cfx:Chart.PlotArea> Although we have no properties to easily word wrap the labels in an axis, we should be able to support this through templating. There is a small bug preventing this scenario. As soon as it is fixed you will be able to do something like <cfx:Chart.AxisX> <cfx:Axis> <cfx:Axis.Template> <DataTemplate> <TextBlock Width="90" Text="{Binding Path=DataItem.Name}" TextWrapping="Wrap" Foreground="{Binding Path=Foreground}" FontFamily="{Binding Path=FontFamily}" FontSize="{Binding Path=FontSize}"/> </DataTemplate> </cfx:Axis.Template> </cfx:Axis></cfx:Chart.AxisX>Regards, JuanC
  15. The ContainerStyle property will not appear on Intellisense but is there and the code I supplied should compile without any issues. Regards, JuanC
  16. The following customization should give you the behavior you are looking for <cfx:Chart.LegendBox> <cfx:LegendBox> <cfx:LegendBox.ContainerStyle> <Style TargetType="{x:Type ItemsControl}"> <Style.Setters> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ItemsControl}"> <ItemsPresenter /> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="ItemsPanel"> <Setter.Value> <ItemsPanelTemplate> <UniformGrid Columns="1"/> </ItemsPanelTemplate> </Setter.Value> </Setter> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"/> </Style.Setters> </Style> </cfx:LegendBox.ContainerStyle> </cfx:LegendBox></cfx:Chart.LegendBox>Using an uniform grid and setting the VerticalScrollBarVisibility to Disabled will give you the squished behavior when the space is not enought to hold all legends. It would be great if we could automatically change our behavior when an image is being generated unfortunately the process uses the same visuals. If you do not want to affect the chart behavior on the screen you could use the Clone method to clone your chart (including data), modify the LegendBox.ContainerStyle on the clone and then Export the clone chart. Regards, JuanC PS: We currently have no plans to fix the scrolling behavior internally.
  17. Move the style into one of your ResourceDictionaries (typically called App.xaml), add a x:Key attribute and then at runtime execute something like chart1.LegendBox.ContainerStyle = (Style) FindResource("CollapsibleLegendStyle"); Regards, JuanC PS: We will research if we can fix the paste behavior.
  18. I apologize for the confusion, if you want the color depending on the value, then conditional attributes and not Points is the right API (if you want to do it in XAML). Unfortunately we do not apply conditionalattributes to the Point collection, we will consider adding this functionality to future versions but in the meantime the only way to achieve color per values and get the correct information in the legend would be to attach to the Chart DataBound event and then loop through the data private void OnDataBound (object sender, EventArgs e){ Brush[] brushes = new Brush[] { Brushes.Black, // 0 Brushes.Red, // 1 Brushes.Green, // 2 Brushes.Blue, // 3 Brushes.Yellow, // 4 Brushes.Brown, // 5 }; for (int i = 0; i < chart1.Data.Points; i++) { int value = (int) chart1.Data[0,i]; if (value < brushes.Length) chart1.Points.Fill = brushes[value]; } } Regards, JuanC
  19. ConditionalAttributes will appear in the legend if they have their content property set, but they are intended to be used for special values e.g. in a line chart when you want to highlight points that have special meaning, not to change the color for all your pie slices. Pie charts will use attributes from the Points collection, so I would recommend you remove the conditional attributes and replace it with the following <cfx:Chart.Points> <cfx:PointAttributes Fill="Red"/> <cfx:PointAttributes Fill="Blue"/> <cfx:PointAttributes Fill="Green"/> <cfx:PointAttributes Fill="Yellow"/></cfx:Chart.Points>Regards, JuanC
  20. We have added the PixelsPerUnit to the Axis class retaining the old (WinForms, ASP.NET) behavior. A hotfix will be available early next week with support for this. Regards, JuanC
  21. This is a bug, we should have a hotfix next week. The workaround you suggested will not be necessary. Regards, JuanC
  22. JuanC

    scrollbar location

    This is a bug, we should have a hotfix next week. Regards, JuanC
  23. JuanC

    Minimizing Ink

    Sometimes you need nice looking charts with lots of gradients and animations but sometimes what you really need is to maximize the space and show trends without too many visual artifacts, this is something that Edward Tufte refer to as
  24. The following XAML shows how to minimize the space used by the X axis <StackPanel Orientation="Horizontal" Grid.Row="1"> <cfx:Chart Gallery="Bar" x:Name="chart1" Width="300" Height="280" Style="{x:Static cfxMotifs:Basic.Style}"> <cfx:Chart.Series> <cfx:SeriesAttributes/> </cfx:Chart.Series> <cfx:Chart.LegendBox> <cfx:LegendBox Visibility="Collapsed"/> </cfx:Chart.LegendBox> </cfx:Chart> <cfx:Chart Gallery="Bar" x:Name="chart2" Width="300" Height="280" Style="{x:Static cfxMotifs:Basic.Style}"> <cfx:Chart.Series> <cfx:SeriesAttributes/> </cfx:Chart.Series> <cfx:Chart.LegendBox> <cfx:LegendBox Visibility="Collapsed"/> </cfx:Chart.LegendBox> <cfx:Chart.PlotArea> <cfx:PlotAreaAttributes Margin="8"/> </cfx:Chart.PlotArea> <cfx:Chart.AxisX> <cfx:Axis Separation="0"> <cfx:Axis.Grids> <cfx:Grids> <cfx:Grids.Major> <cfx:GridLine TickSize="4"/> </cfx:Grids.Major> <cfx:Grids.Minor> <cfx:GridLine TickSize="2"/> </cfx:Grids.Minor> </cfx:Grids> </cfx:Axis.Grids> </cfx:Axis> </cfx:Chart.AxisX> </cfx:Chart> </StackPanel> Note the following - Chart.Style set to Basic to simplify the chart layout - PlotArea.Margin set to 8, this is not directly related to your question but will minimize space taken on the top and right of the plot area. You could set the margin to 0 if you do not show the chart border, otherwise it might look a little crowded - Axis.Separation set to 0 - GridLine.TickSize reduced for both Major and Minor Grid lines. Note that you can win a little more space by setting the TickMark to None We found that we can save a few more pixels when Separation is set to 0, this will be fixed in future hotfixes/service packs. Regards, JuanC
  25. We do not support XmlSerializer as a way to persist a chart. If you use our Export/Import API we will persist all the settings except for data or user-supplied data templates. If you use the Clone API (that returns a cloned chart) we will persist all chart attributes including data. JuanC
×
×
  • Create New...