How to make the bar be a button?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












8












$begingroup$


This is a BarChart:



BarChart[Tooltip[#, "I want tip"] & /@ 1, 2, 3, 
ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]




I hope when I left-right the bar, then I copy the value into the clipboard. Is it possible?










share|improve this question











$endgroup$







  • 1




    $begingroup$
    how about clicking the bar: Deploy@BarChart[Button[#, CopyToClipboard[#]] & /@ 1, 2, 3, ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]?
    $endgroup$
    – kglr
    Jan 24 at 4:23











  • $begingroup$
    @kglr I'm sorry I make a little tuning in the origin question. Actually I want the Button and Tooltip coexsit...
    $endgroup$
    – yode
    Jan 24 at 4:29










  • $begingroup$
    Tooltip is not removed. If the tooltips are removed in your version/os, you can use Button[Tooltip@#, CopyToClipboard[#]] & as wrapper (You might want to add the option PerformanceGoal -> "Quality"if there are many bars in your chart).
    $endgroup$
    – kglr
    Jan 24 at 4:32










  • $begingroup$
    @kglr Do you mean BarChart[Button[Tooltip[#, "I want tip"], #] & /@ 1, 2, 3, ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"] work for you? My version is 11.2..
    $endgroup$
    – yode
    Jan 24 at 4:36











  • $begingroup$
    @kglr The code can draw the bar graphics here, but it cannot copy the value into the clipboard. Please check....
    $endgroup$
    – yode
    Jan 24 at 4:42
















8












$begingroup$


This is a BarChart:



BarChart[Tooltip[#, "I want tip"] & /@ 1, 2, 3, 
ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]




I hope when I left-right the bar, then I copy the value into the clipboard. Is it possible?










share|improve this question











$endgroup$







  • 1




    $begingroup$
    how about clicking the bar: Deploy@BarChart[Button[#, CopyToClipboard[#]] & /@ 1, 2, 3, ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]?
    $endgroup$
    – kglr
    Jan 24 at 4:23











  • $begingroup$
    @kglr I'm sorry I make a little tuning in the origin question. Actually I want the Button and Tooltip coexsit...
    $endgroup$
    – yode
    Jan 24 at 4:29










  • $begingroup$
    Tooltip is not removed. If the tooltips are removed in your version/os, you can use Button[Tooltip@#, CopyToClipboard[#]] & as wrapper (You might want to add the option PerformanceGoal -> "Quality"if there are many bars in your chart).
    $endgroup$
    – kglr
    Jan 24 at 4:32










  • $begingroup$
    @kglr Do you mean BarChart[Button[Tooltip[#, "I want tip"], #] & /@ 1, 2, 3, ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"] work for you? My version is 11.2..
    $endgroup$
    – yode
    Jan 24 at 4:36











  • $begingroup$
    @kglr The code can draw the bar graphics here, but it cannot copy the value into the clipboard. Please check....
    $endgroup$
    – yode
    Jan 24 at 4:42














8












8








8


1



$begingroup$


This is a BarChart:



BarChart[Tooltip[#, "I want tip"] & /@ 1, 2, 3, 
ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]




I hope when I left-right the bar, then I copy the value into the clipboard. Is it possible?










share|improve this question











$endgroup$




This is a BarChart:



BarChart[Tooltip[#, "I want tip"] & /@ 1, 2, 3, 
ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]




I hope when I left-right the bar, then I copy the value into the clipboard. Is it possible?







charts interactive






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 24 at 15:07









gwr

8,46322761




8,46322761










asked Jan 24 at 4:08









yodeyode

10.3k234100




10.3k234100







  • 1




    $begingroup$
    how about clicking the bar: Deploy@BarChart[Button[#, CopyToClipboard[#]] & /@ 1, 2, 3, ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]?
    $endgroup$
    – kglr
    Jan 24 at 4:23











  • $begingroup$
    @kglr I'm sorry I make a little tuning in the origin question. Actually I want the Button and Tooltip coexsit...
    $endgroup$
    – yode
    Jan 24 at 4:29










  • $begingroup$
    Tooltip is not removed. If the tooltips are removed in your version/os, you can use Button[Tooltip@#, CopyToClipboard[#]] & as wrapper (You might want to add the option PerformanceGoal -> "Quality"if there are many bars in your chart).
    $endgroup$
    – kglr
    Jan 24 at 4:32










  • $begingroup$
    @kglr Do you mean BarChart[Button[Tooltip[#, "I want tip"], #] & /@ 1, 2, 3, ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"] work for you? My version is 11.2..
    $endgroup$
    – yode
    Jan 24 at 4:36











  • $begingroup$
    @kglr The code can draw the bar graphics here, but it cannot copy the value into the clipboard. Please check....
    $endgroup$
    – yode
    Jan 24 at 4:42













  • 1




    $begingroup$
    how about clicking the bar: Deploy@BarChart[Button[#, CopyToClipboard[#]] & /@ 1, 2, 3, ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]?
    $endgroup$
    – kglr
    Jan 24 at 4:23











  • $begingroup$
    @kglr I'm sorry I make a little tuning in the origin question. Actually I want the Button and Tooltip coexsit...
    $endgroup$
    – yode
    Jan 24 at 4:29










  • $begingroup$
    Tooltip is not removed. If the tooltips are removed in your version/os, you can use Button[Tooltip@#, CopyToClipboard[#]] & as wrapper (You might want to add the option PerformanceGoal -> "Quality"if there are many bars in your chart).
    $endgroup$
    – kglr
    Jan 24 at 4:32










  • $begingroup$
    @kglr Do you mean BarChart[Button[Tooltip[#, "I want tip"], #] & /@ 1, 2, 3, ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"] work for you? My version is 11.2..
    $endgroup$
    – yode
    Jan 24 at 4:36











  • $begingroup$
    @kglr The code can draw the bar graphics here, but it cannot copy the value into the clipboard. Please check....
    $endgroup$
    – yode
    Jan 24 at 4:42








1




1




$begingroup$
how about clicking the bar: Deploy@BarChart[Button[#, CopyToClipboard[#]] & /@ 1, 2, 3, ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]?
$endgroup$
– kglr
Jan 24 at 4:23





$begingroup$
how about clicking the bar: Deploy@BarChart[Button[#, CopyToClipboard[#]] & /@ 1, 2, 3, ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]?
$endgroup$
– kglr
Jan 24 at 4:23













$begingroup$
@kglr I'm sorry I make a little tuning in the origin question. Actually I want the Button and Tooltip coexsit...
$endgroup$
– yode
Jan 24 at 4:29




$begingroup$
@kglr I'm sorry I make a little tuning in the origin question. Actually I want the Button and Tooltip coexsit...
$endgroup$
– yode
Jan 24 at 4:29












$begingroup$
Tooltip is not removed. If the tooltips are removed in your version/os, you can use Button[Tooltip@#, CopyToClipboard[#]] & as wrapper (You might want to add the option PerformanceGoal -> "Quality"if there are many bars in your chart).
$endgroup$
– kglr
Jan 24 at 4:32




$begingroup$
Tooltip is not removed. If the tooltips are removed in your version/os, you can use Button[Tooltip@#, CopyToClipboard[#]] & as wrapper (You might want to add the option PerformanceGoal -> "Quality"if there are many bars in your chart).
$endgroup$
– kglr
Jan 24 at 4:32












$begingroup$
@kglr Do you mean BarChart[Button[Tooltip[#, "I want tip"], #] & /@ 1, 2, 3, ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"] work for you? My version is 11.2..
$endgroup$
– yode
Jan 24 at 4:36





$begingroup$
@kglr Do you mean BarChart[Button[Tooltip[#, "I want tip"], #] & /@ 1, 2, 3, ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"] work for you? My version is 11.2..
$endgroup$
– yode
Jan 24 at 4:36













$begingroup$
@kglr The code can draw the bar graphics here, but it cannot copy the value into the clipboard. Please check....
$endgroup$
– yode
Jan 24 at 4:42





$begingroup$
@kglr The code can draw the bar graphics here, but it cannot copy the value into the clipboard. Please check....
$endgroup$
– yode
Jan 24 at 4:42











2 Answers
2






active

oldest

votes


















9












$begingroup$

You can wrap input data with Button with action CopyToClipboard:



data = 1, 2, 3;
BarChart[Button[Tooltip[#, "I want tip"], CopyToClipboard@#] & /@ data,
ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


Update: You can add tool tips in several ways:



tooltips = "tooltip1", "tooltip2", "tooltip3";


  1. Use Tooltip as a wrapper on input data:



BarChart[Button[Tooltip@##, CopyToClipboard[#]] & @@@ 
Transpose[1, 2, 3, tooltips],
ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


  1. Use Placed[tooltips, Tooltip] as the setting for the option ChartLabels:



BarChart[Button[#, CopyToClipboard[#]] & /@ data,
ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel",
ChartLabels -> Placed[tooltips, Tooltip]]


  1. Use a custom ChartElementFunction and pass the tooltips as metadata:



ceF[cedf_: "GlassRectangle"] := Button[Tooltip[ChartElementData[cedf][##], #3[[1]]], 
BarChart[Thread[data -> tooltips], ChartElementFunction -> ceF,
ChartStyle -> "Pastel", PlotLabel -> (Paste)]


enter image description here






share|improve this answer











$endgroup$




















    3












    $begingroup$

    This is to get a slightly modified version of kglr's comments recorded as an answer. The modification is provide individual tooltips for each bar.



    BarChart[
    MapThread[
    Button[Tooltip[#1, #2], CopyToClipboard@#1] &,
    1, 2, 3, "left", "mid", "right"],
    ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


    chart.1



    Also, be aware that if only want the tooltip to show the value of the bar, you don't need to specify Tooltip; it will be supplied automatically.



    BarChart[Button[#, CopyToClipboard@#] & /@ 1, 2, 3, 
    ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


    chart.2






    share|improve this answer











    $endgroup$












    • $begingroup$
      Thanks very much..:)
      $endgroup$
      – yode
      Jan 25 at 3:56










    Your Answer





    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("mathjaxEditing", function ()
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    );
    );
    , "mathjax-editing");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "387"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f190147%2fhow-to-make-the-bar-be-a-button%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    9












    $begingroup$

    You can wrap input data with Button with action CopyToClipboard:



    data = 1, 2, 3;
    BarChart[Button[Tooltip[#, "I want tip"], CopyToClipboard@#] & /@ data,
    ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


    Update: You can add tool tips in several ways:



    tooltips = "tooltip1", "tooltip2", "tooltip3";


    1. Use Tooltip as a wrapper on input data:



    BarChart[Button[Tooltip@##, CopyToClipboard[#]] & @@@ 
    Transpose[1, 2, 3, tooltips],
    ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


    1. Use Placed[tooltips, Tooltip] as the setting for the option ChartLabels:



    BarChart[Button[#, CopyToClipboard[#]] & /@ data,
    ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel",
    ChartLabels -> Placed[tooltips, Tooltip]]


    1. Use a custom ChartElementFunction and pass the tooltips as metadata:



    ceF[cedf_: "GlassRectangle"] := Button[Tooltip[ChartElementData[cedf][##], #3[[1]]], 
    BarChart[Thread[data -> tooltips], ChartElementFunction -> ceF,
    ChartStyle -> "Pastel", PlotLabel -> (Paste)]


    enter image description here






    share|improve this answer











    $endgroup$

















      9












      $begingroup$

      You can wrap input data with Button with action CopyToClipboard:



      data = 1, 2, 3;
      BarChart[Button[Tooltip[#, "I want tip"], CopyToClipboard@#] & /@ data,
      ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


      Update: You can add tool tips in several ways:



      tooltips = "tooltip1", "tooltip2", "tooltip3";


      1. Use Tooltip as a wrapper on input data:



      BarChart[Button[Tooltip@##, CopyToClipboard[#]] & @@@ 
      Transpose[1, 2, 3, tooltips],
      ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


      1. Use Placed[tooltips, Tooltip] as the setting for the option ChartLabels:



      BarChart[Button[#, CopyToClipboard[#]] & /@ data,
      ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel",
      ChartLabels -> Placed[tooltips, Tooltip]]


      1. Use a custom ChartElementFunction and pass the tooltips as metadata:



      ceF[cedf_: "GlassRectangle"] := Button[Tooltip[ChartElementData[cedf][##], #3[[1]]], 
      BarChart[Thread[data -> tooltips], ChartElementFunction -> ceF,
      ChartStyle -> "Pastel", PlotLabel -> (Paste)]


      enter image description here






      share|improve this answer











      $endgroup$















        9












        9








        9





        $begingroup$

        You can wrap input data with Button with action CopyToClipboard:



        data = 1, 2, 3;
        BarChart[Button[Tooltip[#, "I want tip"], CopyToClipboard@#] & /@ data,
        ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


        Update: You can add tool tips in several ways:



        tooltips = "tooltip1", "tooltip2", "tooltip3";


        1. Use Tooltip as a wrapper on input data:



        BarChart[Button[Tooltip@##, CopyToClipboard[#]] & @@@ 
        Transpose[1, 2, 3, tooltips],
        ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


        1. Use Placed[tooltips, Tooltip] as the setting for the option ChartLabels:



        BarChart[Button[#, CopyToClipboard[#]] & /@ data,
        ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel",
        ChartLabels -> Placed[tooltips, Tooltip]]


        1. Use a custom ChartElementFunction and pass the tooltips as metadata:



        ceF[cedf_: "GlassRectangle"] := Button[Tooltip[ChartElementData[cedf][##], #3[[1]]], 
        BarChart[Thread[data -> tooltips], ChartElementFunction -> ceF,
        ChartStyle -> "Pastel", PlotLabel -> (Paste)]


        enter image description here






        share|improve this answer











        $endgroup$



        You can wrap input data with Button with action CopyToClipboard:



        data = 1, 2, 3;
        BarChart[Button[Tooltip[#, "I want tip"], CopyToClipboard@#] & /@ data,
        ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


        Update: You can add tool tips in several ways:



        tooltips = "tooltip1", "tooltip2", "tooltip3";


        1. Use Tooltip as a wrapper on input data:



        BarChart[Button[Tooltip@##, CopyToClipboard[#]] & @@@ 
        Transpose[1, 2, 3, tooltips],
        ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


        1. Use Placed[tooltips, Tooltip] as the setting for the option ChartLabels:



        BarChart[Button[#, CopyToClipboard[#]] & /@ data,
        ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel",
        ChartLabels -> Placed[tooltips, Tooltip]]


        1. Use a custom ChartElementFunction and pass the tooltips as metadata:



        ceF[cedf_: "GlassRectangle"] := Button[Tooltip[ChartElementData[cedf][##], #3[[1]]], 
        BarChart[Thread[data -> tooltips], ChartElementFunction -> ceF,
        ChartStyle -> "Pastel", PlotLabel -> (Paste)]


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 25 at 20:09

























        answered Jan 24 at 5:21









        kglrkglr

        183k10201416




        183k10201416





















            3












            $begingroup$

            This is to get a slightly modified version of kglr's comments recorded as an answer. The modification is provide individual tooltips for each bar.



            BarChart[
            MapThread[
            Button[Tooltip[#1, #2], CopyToClipboard@#1] &,
            1, 2, 3, "left", "mid", "right"],
            ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


            chart.1



            Also, be aware that if only want the tooltip to show the value of the bar, you don't need to specify Tooltip; it will be supplied automatically.



            BarChart[Button[#, CopyToClipboard@#] & /@ 1, 2, 3, 
            ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


            chart.2






            share|improve this answer











            $endgroup$












            • $begingroup$
              Thanks very much..:)
              $endgroup$
              – yode
              Jan 25 at 3:56















            3












            $begingroup$

            This is to get a slightly modified version of kglr's comments recorded as an answer. The modification is provide individual tooltips for each bar.



            BarChart[
            MapThread[
            Button[Tooltip[#1, #2], CopyToClipboard@#1] &,
            1, 2, 3, "left", "mid", "right"],
            ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


            chart.1



            Also, be aware that if only want the tooltip to show the value of the bar, you don't need to specify Tooltip; it will be supplied automatically.



            BarChart[Button[#, CopyToClipboard@#] & /@ 1, 2, 3, 
            ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


            chart.2






            share|improve this answer











            $endgroup$












            • $begingroup$
              Thanks very much..:)
              $endgroup$
              – yode
              Jan 25 at 3:56













            3












            3








            3





            $begingroup$

            This is to get a slightly modified version of kglr's comments recorded as an answer. The modification is provide individual tooltips for each bar.



            BarChart[
            MapThread[
            Button[Tooltip[#1, #2], CopyToClipboard@#1] &,
            1, 2, 3, "left", "mid", "right"],
            ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


            chart.1



            Also, be aware that if only want the tooltip to show the value of the bar, you don't need to specify Tooltip; it will be supplied automatically.



            BarChart[Button[#, CopyToClipboard@#] & /@ 1, 2, 3, 
            ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


            chart.2






            share|improve this answer











            $endgroup$



            This is to get a slightly modified version of kglr's comments recorded as an answer. The modification is provide individual tooltips for each bar.



            BarChart[
            MapThread[
            Button[Tooltip[#1, #2], CopyToClipboard@#1] &,
            1, 2, 3, "left", "mid", "right"],
            ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


            chart.1



            Also, be aware that if only want the tooltip to show the value of the bar, you don't need to specify Tooltip; it will be supplied automatically.



            BarChart[Button[#, CopyToClipboard@#] & /@ 1, 2, 3, 
            ChartElementFunction -> "GlassRectangle", ChartStyle -> "Pastel"]


            chart.2







            share|improve this answer














            share|improve this answer



            share|improve this answer








            answered Jan 24 at 5:35


























            community wiki





            m_goldberg












            • $begingroup$
              Thanks very much..:)
              $endgroup$
              – yode
              Jan 25 at 3:56
















            • $begingroup$
              Thanks very much..:)
              $endgroup$
              – yode
              Jan 25 at 3:56















            $begingroup$
            Thanks very much..:)
            $endgroup$
            – yode
            Jan 25 at 3:56




            $begingroup$
            Thanks very much..:)
            $endgroup$
            – yode
            Jan 25 at 3:56

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Mathematica Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f190147%2fhow-to-make-the-bar-be-a-button%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay