【问题标题】:Color highpoint/lowpoint in sparkline excel plot through MATLAB通过MATLAB在迷你图excel图中的颜色高点/低点
【发布时间】:2013-08-02 16:16:25
【问题描述】:

参考我之前的问题 (add sparklines to excel with matlab),我可以设法创建迷你图,但我不知道如何将高点/低点着色为绿色/红色。我试过了:

% Open new workbook
excel         = actxserver('excel.application');
excel.visible = 1;
wrkbook       = excel.Workbooks.Add();
sheet         = wrkbook.Sheets.Item(1);

% Write some data
sheet.Range('B1:Z1').Value = rand(1,25);

% Add column sparklines to 'A1', type 'xlSparkColumn' and DataSource: 'B1:Z1'
excel.ReferenceStyle = 'xlA1';
s = sheet.Range('A1').SparklineGroups.Add('xlSparkColumn','B1:Z1');

% Color
s.Point.Highpoint.Color.Color = 4697456;
s.Point.Lowpoint.Color.Color  = 255;

另请参阅setting custom cell background color上的此参考

【问题讨论】:

    标签: excel matlab com activex


    【解决方案1】:

    试试:

    % set highpoint color to red (color format is BGR)
    s.Points.Highpoint.Color.Color = hex2dec('0000FF');
    
    % make it visible
    s.Points.Highpoint.Visible = true;
    

    【讨论】:

    • 感谢.Visible = true。我有点赶时间,但一旦我有时间,我一定会检查你之前的工具链接。
    猜你喜欢
    • 1970-01-01
    • 2018-08-14
    • 2013-08-02
    • 1970-01-01
    • 2018-08-15
    • 2020-11-10
    • 1970-01-01
    • 1970-01-01
    • 2016-05-30
    相关资源
    最近更新 更多