首页 > 其他分享 >WPF,图表控件

WPF,图表控件

时间:2024-06-06 16:15:53浏览次数:16  
标签:控件 set string get 图表 WPF public

开源代码地址:https://github.com/bearhanQ/WPFFramework;

QQ群:332035933;

<UserControl x:Class="WpfBootstrap.View.ChartsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:WpfBootstrap.View"
             xmlns:s="clr-namespace:System;assembly=mscorlib"
             xmlns:m="clr-namespace:WpfBootstrap.Model"
             xmlns:cc="clr-namespace:WPFTemplate;assembly=WPFTemplate"
             xmlns:p="clr-namespace:WpfBootstrap.Common"
             xmlns:vws="clr-namespace:WpfBootstrap.View"
             mc:Ignorable="d"
             d:DesignHeight="600" d:DesignWidth="400">
    <UserControl.Resources>
        <x:Array x:Key="revenueInfo" Type="{x:Type m:Revenue}">
            <m:Revenue Day="周一" Value="1000000"/>
            <m:Revenue Day="周二" Value="1500000"/>
            <m:Revenue Day="周三" Value="2000000"/>
            <m:Revenue Day="周四" Value="5000000"/>
            <m:Revenue Day="周五" Value="2500000"/>
            <m:Revenue Day="周六" Value="3000000"/>
            <m:Revenue Day="周七" Value="1000000"/>
        </x:Array>
        <p:BarValueWarningConverter x:Key="BarValueWarningConverter"/>
        <Style x:Key="barStyle1" TargetType="{x:Type cc:Bar}">
            <Setter Property="ItemContainerStyle">
                <Setter.Value>
                    <Style TargetType="{x:Type cc:BarItem}" BasedOn="{StaticResource {x:Type cc:BarItem}}">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Value,Converter={StaticResource BarValueWarningConverter},ConverterParameter=2000000}" Value="True">
                                <DataTrigger.Setters>
                                    <Setter Property="Background" Value="#FFF4D505"/>
                                </DataTrigger.Setters>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Value,Converter={StaticResource BarValueWarningConverter},ConverterParameter=3000000}" Value="True">
                                <DataTrigger.Setters>
                                    <Setter Property="Background" Value="Red"/>
                                </DataTrigger.Setters>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <cc:CornerScrollViewer>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="300"/>
                <RowDefinition Height="300"/>
                <RowDefinition Height="300"/>
            </Grid.RowDefinitions>
            <cc:Bar ItemsSource="{StaticResource revenueInfo}" ValueMemberPath="Value" DisplayMemberPath="Day" Style="{StaticResource barStyle1}"/>
            <cc:Donut ItemsSource="{StaticResource revenueInfo}" ValueMemberPath="Value" DisplayMemberPath="Day"
                  Grid.Column="1" ArcThickness="60" Orientation="Vertical"/>
            <cc:LineChart Grid.Row="1" ItemsSource="{StaticResource revenueInfo}" DisplayMemberPath="Day" ValueMemberPath="Value" OpenAnimation="False"/>
            <cc:CurveChart Grid.Row="1" Grid.Column="1" ItemsSource="{StaticResource revenueInfo}" 
                       DisplayMemberPath="Day" ValueMemberPath="Value" OpenAnimation="False"
                       Stroke="Red"/>
            <cc:StepChart Grid.Row="2" ItemsSource="{StaticResource revenueInfo}" Stroke="#FF0CFF00"
                      DisplayMemberPath="Day" ValueMemberPath="Value" OpenAnimation="False"/>
        </Grid>
    </cc:CornerScrollViewer>
</UserControl>

  

    public class Revenue
    {
        public string Month { get; set; }
        public string Day { get; set; }
        public string Profits { get; set; }
        public int Value { get; set; }
    }

 

标签:控件,set,string,get,图表,WPF,public
From: https://www.cnblogs.com/lvpp13/p/18235441

相关文章

  • wpf datagrid绑定行选中状态
    样式如下<DataGridMargin="0,6,0,0"HeadersVisibility="All"RowHeaderWidth="60"HorizontalScrollBarVisibility="Visible"AutoGenerateColumns="False"ItemsSource="{BindingDispl......
  • 界面控件Telerik UI for WPF中文教程 - 用RadSvgImage升级应用程序UI
    TelerikUIforWPF拥有超过100个控件来创建美观、高性能的桌面应用程序,同时还能快速构建企业级办公WPF应用程序。UIforWPF支持MVVM、触摸等,创建的应用程序可靠且结构良好,非常容易维护,其直观的API将无缝地集成VisualStudio工具箱中。TelerikUIforWPF中的RadSvgImage组件使......
  • c#WinFrom自定义图表仪表控件-频谱
     这是为客户定制的一个频谱图表控件,先看下成品效果,gif较大,略等片刻   开发步骤分析:1、界面有多个间距不等的线分割的区域,每个区域的值范围不同,我们就需要把每个区域定义出来,方便我们操作的时候来计算值2、有几个圆圈是需要鼠标来回拖动的,那么就需要将每个圆的区域定义......
  • 解锁用Mermaid绘制图表的神奇力量
    在这个快节奏、信息爆炸的时代,我们迫切需要一种简单、高效且美观的方式来表达复杂的思想和流程。幸运的是,Mermaid就是这样一种工具。无论你是开发者、项目经理还是设计师,Mermaid都能帮助你轻松绘制各种类型的图表,让你的文档和报告更加生动有趣。现在,让我们一起探索如何使......
  • WPF TranslateTransform +=deltaX +=deltaY
    <Windowx:Class="WpfApp136.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft......
  • WPF初学习(一)
    控件模板控件模板又包括ControlTemplate和ItemsPanelTemplateControlTemplate(控件模板)不仅是用于来定义控件的外观、样式,还可通过控件模板的触发器(ControlTemplate.Triggers)修改控件的行为、响应动画等。样式定义了一些基础的样式,背景颜色、字体颜色、边框大小、垂直水......
  • WPF界面反编译神器Snoop使用介绍
    Snoop介绍Snoop是一款开源的WPF监视工具,它能够监视或浏览任何正在运行的WPF应用程序的可视化、逻辑和自动化树(无需调试器),还可以更改属性值、查看触发器、在属性更改时设置断点等。项目地址:https://github.com/snoopwpf/snoopwpf 运行可以到githubrelease下载已经编译......
  • QT笔记:重定向qDebug到控件
    QT笔记:重定向qDebug到控件作为log输出的qDebug可以将调试信息打印到调试终端中,但是有时候实际使用将其输出到UI界面也是很有用的,这里记录下如何将qDebug进行控件重定向。测试版本为QT6.6.2代码mainwindow.h//只要能正常编译过qDebug的就行#include<QMainWindow>QT_BEGIN_......
  • Avalonia下的主题控件Semi.Avalonia
    安装Install-PackageSemi.Avalonia添加样式引用:<Application.Styles><StyleIncludeSource="avares://Semi.Avalonia/Themes/Index.axaml"/></Application.Styles>ColorPicker,DataGrid和TreeDataGrid的样式单独分发,如果需要请安装并引用。Install-Pack......
  • 抢先看!报表控件Fastreport 全系 .NET 产品更新至 2024.2 版本
    我们很高兴向您介绍整个FastReport.NET组件系列期待已久的更新。在此版本中,您可以期待一个具有AvaloniaUI支持的新报告生成器、数据导出的改进、对FastReport.Core.Skia的HTML插件支持,当然还有对.NETStandard2.0-3.1和.NET5的停止支持。FastReport.NET ......