Jump to content
Software FX Community

JuanC

Staff
  • Posts

    863
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by JuanC

  1. ChartFX.XBAP uses the same API (class names, properties, even namespaces) as ChartFX.WPF so you should be able to use ChartFX.WPF in a sample WPF app (non browser hosted). This will also remove the strong name limitation as you will not need to use SetLicenseString.

    JuanC

  2. It would be something like this



    <cfx:Chart.AllSeries>

      <cfx:AllSeriesAttributes>

      <cfx:AllSeriesAttributes.Template>

      <DataTemplate>

      <Canvas>

      <Polyline
    Points="{Binding Path=Points}"
    Stroke="Transparent" StrokeThickness="10"
    StrokeMiterLimit="1"/>

      <Polyline x:Name="points"
    Points="{Binding Path=Points}"
    Stroke="{Binding Path=Stroke}"
    StrokeThickness="{Binding Path=StrokeThickness}"
    StrokeDashArray="{Binding Path=StrokeDashArray}"
    Opacity="{Binding Path=Opacity}"
    StrokeMiterLimit="1"/>

      </Canvas>

      <DataTemplate.Triggers>

      <DataTrigger
    Binding="{Binding Path=Dimmed}">

      <DataTrigger.Value>

      <sys:Boolean>True</sys:Boolean>

      </DataTrigger.Value>

      <Setter
    Property="Opacity" Value="0.25"
    />

      </DataTrigger>

      </DataTemplate.Triggers>

      </DataTemplate>

      </cfx:AllSeriesAttributes.Template>

      </cfx:AllSeriesAttributes>

    </cfx:Chart.AllSeries>



     

    This is a copy of our simple line template but I added a transparent PolyLine that increases the tooltip area of the line.

    JuanC

  3. Instead of setting the step you might want to try changing the number of decimals used in the Y axis.



    chart1.AxisY.Labels.Decimals = 2;
    chart1.AxisY.DataFormat.Decimals
    = 3;



    The first line would only affect the axis labels while the second would affect things like tooltips. If the data range is variable you could do something like this



    chart1.DataBound += new EventHandler(OnChartBound);
    private void OnChartBound (object
    sender, EventArgs e)
    {
      if
    ((chart1.AxisY.Max - chart1.AxisY.Min) < 2)
      chart1.AxisY.Labels.Decimals = 2;
    }

     

    JuanC

  4. Which gallery type are you using? Are you using a specific motif/style? We do not have an API that would increase the tooltip area but this is something that could be achieved by providing your own gallery template that adds some trasparent shape around the visuals that represent the data.

    JuanC

  5. Note that in an stacked area chart the series are drawn from bottom to top, i.e. the first series is draw first from 0 to the series values, then the second series is drawn from the previous series values.

    We do not have an API that allows you to change this order (or the Z order if we were talking about a non-stacked) chart so you will have to change the order in which you add the series to the chart.

    JuanC

  6. We do not support moving and/or sizing annotations as we do in WinForms.

    You might want to try to use the Adorner API, note that this sample will draw adorners around all annotation elements, you would probably want to play with the visibility so that only one of them is visible at a time and also handle event to support moving and/or sizing

    AdornerLayer myAdornerLayer
    = AdornerLayer.GetAdornerLayer(chart1);
    foreach(UIElement uiElem in
    annotations.Children)
      myAdornerLayer.Add(new
    SimpleCircleAdorner(uiElem));

    You can use the SimpleCircleAdorner class and more info about the Adorner API here   

    JuanC

  7. Have you checked when the NullReferenceException occurs? I tested placing the legend inside using XAML

    <cfx:Chart Name="chart1" Border="{x:Static cfx:Borders.Classic}" Palette="{x:Static cfx:Palettes.Basic}" Style="{x:Static cfxmotifs:Simple.Style}">   <cfx:Chart.LegendBox>   <cfx:LegendBox cfx:Chart.TargetPanel="Inside" HorizontalAlignment="Right" VerticalAlignment="Top"/>   </cfx:Chart.LegendBox></cfx:Chart> 

    I also tried using code in the Page_loaded method instead of XAML as follows

    Chart.SetTargetPanel(chart1.LegendBox, "Inside");chart1.LegendBox.HorizontalAlignment = HorizontalAlignment.Right;chart1.LegendBox.VerticalAlignment = VerticalAlignment.Top;

    Both ways worked fine. If you try any of these and they fail you might want to download our most recent hotfix.

    JuanC

  8. We have been able to duplicate this issue and a future hotfix should take care of this.

    In the meantime and as a workaround to this issue, you can set the ContentTemplate (instead of setting the Content to a Visual) as follows

    <cfx:Chart.Titles>   <cfx:Title ContentTemplate="{Binding Source={StaticResource titleTemplate}}" />

    You might also have to set the Content to allow your bindings to work, try first with a simple titleTemplate, e.g. a stackpanel with a rectangle and hardcoded text to make sure the workaround works for you. 

    JuanC

  9. 2) You can use the Chart.Selection.StartMouseSelection method, you can pass a null template to use our default selection template, we will notify the handler when the selection is finished. The handler receives a MouseSelectionArgs that provides you with the From and To as points, you can use Axis.PixelToValue to convert these coordinates to axis values, MouseSelectionArgs also provides a helper property Markers which will return all the markers selected by the user.

    JuanC

  10. Our default style (glass) places the first chart title on a different container that is not aligned to the plotarea.

    If you are using the basic or simple motif, then you can set the AlignToPlotArea dependency property on your title as follows

    xmlns:cfxControls="clr-namespace:ChartFX.WPF.Controls;assembly=ChartFX.WPF" 

    <cfx:Chart.Titles<cfx:Title cfxControls:SpacingDockPanel.AlignToPlotArea="false">A very long title that is not aligned to the plot area</cfx:Title></cfx:Chart.Titles>

    This should also work if you are creating your own style.

    JuanC

  11. The following XAML shows how to change the style of the legend box

    <cfx:Chart Gallery="Bar">  <cfx:Chart.LegendBox>   <cfx:LegendBox ContainerStyle="{StaticResource tooltipLegend}" /> </cfx:Chart.LegendBox></cfx:Chart>

    The following 2 styles will display a collapsible legend box as well as a placeholder (red rectangle) showing the legendbox as a tooltip.

    <Style x:Key="collapsibleLegend" TargetType="{x:Type ItemsControl}">  <Style.Setters>   <Setter Property="Template">   <Setter.Value>   <ControlTemplate TargetType="{x:Type ItemsControl}">   <Expander x:Name="expLegend" Header="Legend Box">   <ItemsPresenter />   </Expander>   </ControlTemplate>   </Setter.Value>   </Setter>  </Style.Setters></Style><Style x:Key="tooltipLegend" TargetType="{x:Type ItemsControl}">  <Style.Setters>   <Setter Property="Template">   <Setter.Value>   <ControlTemplate TargetType="{x:Type ItemsControl}">   <Rectangle Width="16" Height="16" Fill="Red" Stroke="Black">   <Rectangle.ToolTip>   <ItemsPresenter />   </Rectangle.ToolTip>   </Rectangle>   </ControlTemplate>   </Setter.Value>   </Setter>  </Style.Setters></Style>

    JuanC

  12. Although WPF is hardware accelerated there are some performance differences between WPF and GDI related to how elements are painted. Unfortunately We do not have any samples for performance testing.

    In Chart FX for WPF I would recommend you try the following if performance is not satisfactory

    - Change the Style which controls most of the visuals of the chart, e.g. chart1.Style = ChartFX.WPF.Motifs.Basic.Style;

    - Set UseVisuals to false, this will use low-level rendering which sometimes is faster but you will lose the templatibility of the galleries.

    JuanC

  13. >> select data on a chart with mouse by dragging like rectangle then retrive data relevant to index or Y value

    This is possible, you need to use the Chart.Selection.StartMouseSelection method and supply a delegate that will be called after the user draws the selection rectangle.

    >> We'd like to do something like jobs such as adding limit lines for available data on already displayed charts.

    There are several ways to accomplish this, if you only need horizontal/vertical lines you can use Axis.CustomGridLines, we also support annotations where you can create visuals (lines, buttons, etc.) and attach them to logical positions in the chart. Finally we also support for you to handle an event to render additional elements in the chart, please note that because of the differences between GDI and WPF you will normally not paint on the screen but instead create logical items that are in turn templated into visuals.

    JuanC

×
×
  • Create New...