動作環境
Windows 8.1 Pro (64bit)
Microsoft Visual Studio 2017 Community
Sublime Text 2
処理内容
- 折れ線グラフのSeriesの属性を変える
- 塗りつぶし解除
- マーカー非表示
用語
https://lvcharts.net/App/examples/v1/wpf/Basics
に用語説明があるが、データポイントの丸の用語は不明。
Excelでは「マーカー」という用語なので、「マーカー」をここでは使う。
(pointという用語かもしれない)。
参考
https://qiita.com/7of9/items/cdeaf7725bff2b922849
をベースに変更した。
30 Series 10k points each
に線の属性を変更する例が見つかった。
code
FillとPointGeometry を設定する。
MainWindow.xaml
<Window x:Class="_171127_t1053_lineWidth.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:_171127_t1053_lineWidth"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<StackPanel>
<lvc:CartesianChart Series="{Binding seriesCollection}" Height="250"
LegendLocation="Right"/>
</StackPanel>
</Grid>
</Window>
MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
// 以下を追加した
using LiveCharts;
using LiveCharts.Wpf;
namespace _171127_t1053_lineWidth
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
graph_init();
}
private void graph_init()
{
gd = new GraphData();
var sc = new SeriesCollection {
new LineSeries
{
Title = "pi1",
Values = new ChartValues<double> { 3, 1, 4, 1, 5, 9, 2 }
},
new LineSeries
{
Title = "pi2",
Fill = Brushes.Transparent, // Fillをやめる
Values = new ChartValues<double> { 6, 5, 3, 5, 8, 9, 7 }
},
new LineSeries
{
Title = "napier",
Fill = Brushes.Transparent, // Fillをやめる
PointGeometry = null, // マーカーをとる
Values = new ChartValues<double> { 2, 7, 1, 8, 2, 8, 1, 8 }
}
};
gd.seriesCollection = sc;
this.DataContext = gd;
}
GraphData gd;
public class GraphData
{
public SeriesCollection seriesCollection { get; set; }
}
}
}
リンク
Customizing Series
にいくつかの設定項目が掲載されているが、全部が載っているというわけでもない。