SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

0
0

I can’t seem to find it in the API, but I figured I’d ask .Is any built in support for live editing the Chart Title or Axis Titles right on the chart surface like you can with a TextAnnotation?

  • You must to post comments
0
0

No, there isn’t I’m afraid, however I have a workaround for you.

Editing Chart Titles

The Chart Title is shown in a TextBlock on the chart and Textblock.Text is bound to SciChartSurface.ChartTitle property.

What I would suggest you do is show some UI over the top of the chart to edit the chart title, then set the title of SciChartSurface.ChartTitle after editing.

I know this is lame but unfortunately this part cannot be customised in the current UI.

Editing Axis Titles

These parts are templatable, so you can swap out an Axis title for any UI.

Please take a look at Styling Axis Labels, Axis Titles, Rotating Axis Labels which has a complete walk through how to style the chart parts.

In particular,

How to Template the Axis Title
To insert a custom Control into the Axis Title, you can use this code.

<Style x:Key="BottomAxisTitleStyle" TargetType="s:AxisTitle">
    <Setter Property="ContentTemplate">
        <Setter.Value>
            <DataTemplate>
                <StackPanel>
                    <TextBlock Margin="0,3,0,0" Style="{StaticResource TitleTextStyle}" Text="Showing time on"/>
                    <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding}"/>
                    <TextBlock Margin="0,0,0,3" Style="{StaticResource TitleTextStyle}" Text="(daily Timeframe)"/>
                </StackPanel>
            </DataTemplate>
        </Setter.Value>
    </Setter>
</Style>
 
<s:DateTimeAxis TitleStyle="{StaticResource BottomAxisTitleStyle}" />

Using this API you could change the Axis TitleStyle and control template to any UI, swapping it for a TextBlock with a TextBox over the top of it.

Hope this helps,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.