Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Creating pbiviz package from Custom Visual using Gulp

Hi there

 

I have made some changes to the great Power BI Aquarium visual: 

https://community.powerbi.com/t5/Best-Visual-Contest/Power-BI-Aquarium/cns-p/7233

 

Now need to create the .pbiviz package.

 

The command:

gulp package

gives the error:

 

[16:33:20] Using gulpfile ~\Documents\Power BI\Dev Custom Visuals\PowerBI-visuals-master\gulpfile.js
[16:33:21] Task 'package' is not in your gulpfile
[16:33:21] Please check the documentation for proper gulpfile formatting

"gulp build" and "gulp run:playground" function correctly.

 

Have installed [email protected], but no luck with "gulp package"

 

Any ideas?  Do I need to create a new bundle.json file as described at: http://amolpandey.com/2016/08/02/powerbi-how-to-create-pbiviz-file-custom-visualization 

 

Thanks!

  • v-viig's avatar
    v-viig
    8 years ago

    The getColor method returns an instance of IColorInfo.

     

    To fix the issue you should return an object like this:

     

    {
      value: "#ED1C24"
    }
    

     

    Ignat Vilesov,

    Software Engineer

     

    Microsoft Power BI Custom Visuals

    [email protected]

5 Replies

  • v-viig's avatar
    v-viig
    Community Champion

    This is the old way of building packages that no longer supported. Instead of gulp Custom Visuals use PBIVIZ nowadays.

     

    We'd recommend to contact [email protected] and [email protected] who owns source code.

    Probably he will share the updated code that uses PBIVIZ.

     

    Otherwise, you would need to convert code to PBIVIZ format by yourself.

     

    Ignat Vilesov,

    Software Engineer

     

    Microsoft Power BI Custom Visuals

    [email protected]

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi v-viig - thank you for the reply.  I have reached out to Enlighten.

       

      Will then either convert the visual from the legacy format to the new format, or edit the pbiviz.json file (its a minor color change).

       

      Do you know what format the colour is returned in json:

       

      var m = e.getColor(h.toString());

      I want to replace with something like:

      var m=\"#ED1C24\";

      which does not work (visual is returned in black, irrespective of hex code).

      • v-viig's avatar
        v-viig
        Community Champion

        The getColor method returns an instance of IColorInfo.

         

        To fix the issue you should return an object like this:

         

        {
          value: "#ED1C24"
        }
        

         

        Ignat Vilesov,

        Software Engineer

         

        Microsoft Power BI Custom Visuals

        [email protected]

  • Anonymous's avatar
    Anonymous
    Not applicable

    Gulpfile.js needs a line something like:

     

    gulp.task('package', () => {
        // Zip to .pbiviz file
        gulp.src('dist/**')
            .pipe(zip('MyModule.pbiviz'))
            .pipe(gulp.dest('.'));
    });

    to create the package.

    • v-viig's avatar
      v-viig
      Community Champion

      Anonymous We'd recommned not to use legacy API based visuals and tools as they're almost deprecated.

      Please consider migration to PBIVIZ tools instead of gulp.

       

      Ignat Vilesov,

      Software Engineer

       

      Microsoft Power BI Custom Visuals

      [email protected]